arrow function syntax es5 code example
Example 1: es6 arrow function
const multiplyES6 = (x, y) => x * y;
Example 2: es6 arrow function
//ES5
var phraseSplitterEs5 = function phraseSplitter(phrase) {
return phrase.split(' ');
};
//ES6
const phraseSplitterEs6 = phrase => phrase.split(" ");
console.log(phraseSplitterEs6("ES6 Awesomeness")); // ["ES6", "Awesomeness"]