Created
November 26, 2017 21:21
-
-
Save battmanz/091a0f4c8a9109087b8f71274f0bbb61 to your computer and use it in GitHub Desktop.
Demonstrates using the Array.prototype.map method with a partially applied 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 partialCreateRanking = _.partial(createRanking, currentUser); | |
| console.log(orderedHeroes.map(partialCreateRanking)); | |
| // 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