Functions using arrow function Expression
var multiply = function (num: number) { return num * num; }
The same above function could be written using arrow key expression as below
var multiply = (num1: number, num2: number) => return num1 * num2; //With flower braces in case of multiple statements var multiply = (num1: number, num2: number) => {return num1 * num2;};
we can also do function declaration and definition in two separate lines as one below
//function declaration var multiply: (num1: number, num2: number) => number; //function definition multiply = function (num1: number, num2: number) { return num1 * num2; } //function taking object literals as arguments var multiply: (numbs: { num1: number, num2: number }) => number; var numbs = { num1: 2, num2: 4 }; multiply = function (numbs) { return numbs.num1 * numbs.num2; }