javascript arrow function implicit return code example
Example 1: implicit return arrow function
// Single-lineconst
implicit = (value) => value;
// Multi-lineconst
implicit = (value) => (
value
);
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"]