CodesJava

Easy learning with example program codes

Typescript function constructor tutorial


A TypeScript function is a group of statements which is used for performing a specific task. It provides the facility of code re-usability.

TypeScript provides the facility to create a function with the built-in JavaScript constructor called Function ().

Typescript function constructor syntax:

var result = new Function( [arguments] ) { ... }

Typescript function constructor example:

var myFunction = new Function("num1", "num2", "return num1 + num2"); 
var result = myFunction(10, 15); 
console.log(result);

Try it:

JS Bin on jsbin.com
 

Please follow and like us:


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