Created
November 26, 2017 21:29
-
-
Save battmanz/02de1ce6c51142bac9f16498f57d53a2 to your computer and use it in GitHub Desktop.
Demonstrates using the Array.prototype.map method with a curried function.
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 curriedCreateRanking = _.curry(createRanking); | |
| const whatIsThis = curriedCreateRanking(currentUser); | |
| console.log(orderedHeroes.map(whatIsThis)); | |
| // Output: [ | |
| // {'username':'George','rebel':'Luke Skywalker','index':0}, | |
| // {'username':'George','rebel':'Han Solo','index':1}, | |
| // {'username':'George','rebel':'Leia Organa','index':2}, | |
| // {'username':'George','rebel':'Rey','index':3}, | |
| // {'username':'George','rebel':'Finn','index':4}, | |
| // {'username':'George','rebel':'Poe Dameron','index':5} | |
| // ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment