Skip to content

Instantly share code, notes, and snippets.

@wklug
Created October 14, 2016 21:12
Show Gist options
  • Save wklug/0c6695c203d393a89002431e21f7fa7b to your computer and use it in GitHub Desktop.
Save wklug/0c6695c203d393a89002431e21f7fa7b to your computer and use it in GitHub Desktop.
ES6 - Arrow functions are always anonymous.
/**
* ES6 - Arrow functions.
*
* Arrow functions are always anonymous. Useful for one line callbacks.
**/
const people = [
{
name: 'P. Nutt',
age: 18
},
{
name: 'Hazel Nutt',
age: 28
},
{
name: 'Manny Bones',
age: 88
}
];
people.map(person => { console.log(`${person.name} is ${person.age} years old.`) });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment