Easy learning with example program codes

typescript anonymous 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.

A function created without function name is known as anonymous function.

Typescript anonymous function syntax:

var result = function( [arguments] ) { ... }

Typescript anonymous function example:

var sayHello = function() { 
   return "Hello World!";  

Typescript anonymous function with parameters example:

var sayHello = function(name:string) { 
   return "Hello "+name;  

Try it:

JS Bin on

Please follow and like us:

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki