TypeScript - Calling a Function



A function must be called so as to execute it. This process is termed as function invocation.

Syntax

Function_name()

The following example illustrates how a function can be invoked −

Example

function test() {   // function definition    
   console.log("function called") 
} 
test()              // function invocation

On compiling, it will generate the same JavaScript code.

function test() { 
   console.log("function called"); 
} 
test();    // function invocation

It will produce the following output −

function called
typescript_functions.htm
Advertisements