Created
January 4, 2017 00:20
-
-
Save ericelliott/9ae83562843b9b9f3b2f13ffb3fe54a4 to your computer and use it in GitHub Desktop.
Map with custom data type
This file contains hidden or 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
const double = n => n.points * 2; | |
const doubleMap = numbers => numbers.map(double); | |
console.log(doubleMap([ | |
{ name: 'ball', points: 2 }, | |
{ name: 'coin', points: 3 }, | |
{ name: 'candy', points: 4} | |
])); // [ 4, 6, 8 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment