Easy learning with example program codes

typescript returning function

A TypeScript function is a group of statements which is used for performing a specific task. It provides the facility of code re-usability. The returning functions return the value back to the caller.

Typescript returning function syntax:

function function_name():return_type { 
   //block of statements 
   return value; 

Typescript Returning Function Example:

function getMessage():string { 
   return "Hello World!";
function sayHello() { 
   var msg = getMessage();

Try it:

JS Bin on

Please follow and like us:

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki