0
Q:

arrow function in typescript

let sum = (x: number, y: number): number => {
    return x + y;
}

sum(10, 20); //returns 30
4
//prototype 
const/let <FunctionName> = (params: type) :<ReturnType> =>{
  ....
};

const PrintName =  (name: string): string => {
  return console.log("my name is " , name) ;
}
1
// ES6: With arrow function  
var getResult = (username: string, points: number): string => {  
  return `${ username } scored ${ points } points!`;  
};

getResult('joyous jackal' , 100);
1

New to Communities?

Join the community