TypeScript - Defining a Function


Advertisements

A function definition specifies what and how a specific task would be done. Before using a function, it must be defined. Functions are defined using the function keyword. The syntax for defining a standard function is given below −

Syntax

function  function_name() { 
   // function body 
}

Example: simple function definition

function () {   
   //function definition 
   console.log("function called") 
}
typescript_functions.htm
Advertisements