Tuesday, November 6, 2018

TypeScript - ES6 - arrow functions variations

arrow function without arguments:
const walkFunc = () => {
console.log("walk to Tadipatri");
};

walkFunc();

Console Output:
walk to Tadipatri


arrow function with a single argument:
const singFunc = (songName:string) => console.log(songName);
singFunc("Vande Mataram!");


Console Output:
Vande Mataram!

No comments:

Post a Comment