Google News
logo
TypeScript - Interview Questions
What is Lambda/Arrow function?
ES6 version of TypeScript provides shorthand syntax for defining the anonymous function, i.e., for function expressions. These arrow functions are also called Lambda functions. A lambda function is a function without a name. Arrow function omits the function keyword.
 
Example :
let sum = (a: number, b: number): number => {    
            return a + b;    
}  
console.log(sum(20, 30)); //returns 50    
In the above, the ?=>? is a lambda operator and (a + b) is the body of the function and (a: number, b: number) are inline parameters.
Advertisement