Created
October 14, 2016 21:12
-
-
Save wklug/0c6695c203d393a89002431e21f7fa7b to your computer and use it in GitHub Desktop.
ES6 - Arrow functions are always anonymous.
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
/** | |
* 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