CodesJava

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();
   console.log(msg);
} 
 
sayHello();

Try it:

JS Bin on jsbin.com
 

Please follow and like us:


Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki