Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created September 17, 2015 12:51
Show Gist options
  • Select an option

  • Save dnasca/fa0772cbedd4b2aecfa4 to your computer and use it in GitHub Desktop.

Select an option

Save dnasca/fa0772cbedd4b2aecfa4 to your computer and use it in GitHub Desktop.
ES2015 Fat Arrow Function
let arr = [4, 9, 14];
// the old way
let newArr = arr.map(function (value) {
return value + 1;
});
// the new way - ES2015 (3 examples of the same function, each better than the one before it)
let newArr = arr.map( (value) => { return value +1; });
arr.map( value => { return value + 1; });
arr.map( value => value + 1 )
console.log(newArr);
console.log(newArr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment