Fat Arrow Function in JavaScript

 // Fat Arrow Function in JavaScript


// Old style es5 function

// var sum = function()
// {
// var a = 5;
// var b = 10;
// return a+b;
// }
// console.log(sum());

// es6 Latest Fat Arrow Function


// const sum = () =>{
// let a = 65;
// let b = 10;
// return a+b;
// }
// console.log(sum());

// es6 latest another style

let a = 20;
let b = 50;
const sum = () => a+b
console.log(sum());

Comments

Popular posts from this blog

React Native FlatList

React Native class component