Created
July 10, 2020 12:55
-
-
Save rishisidhu/da94042c7c746142a9b20a50ce4ea9a0 to your computer and use it in GitHub Desktop.
Modern JS ES6+ features - Arrow Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The old way of writing functions | |
var addf = function add(x, y) { | |
var sum = x + y; | |
return sum; | |
}; | |
console.log(`The sum is : ${addf(10, 20)}`); | |
//The new way of writing functions | |
var newAdd = (x, y) => x + y; | |
console.log(`The sum is : ${newAdd(10, 20)}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment