Last active
November 26, 2017 21:29
-
-
Save battmanz/5b0327d6cd0732c4e2d78e7b2a93e413 to your computer and use it in GitHub Desktop.
The necessary setup required to demonstrate currying vs partial application.
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 currentUser = 'George'; | |
| const starWarsHeroes = [ | |
| 'Luke Skywalker', | |
| 'Han Solo', | |
| 'Leia Organa', | |
| 'Rey', | |
| 'Finn', | |
| 'Poe Dameron' | |
| ]; | |
| function getOrderedHeroes() { | |
| // In a real app, we'd have a nice drag-and-drop UI to allow the user to order these. | |
| // This function would then examine the DOM and create the ordered array. | |
| return starWarsHeroes; | |
| } | |
| const orderedHeroes = getOrderedHeroes(); | |
| function createRanking(username, hero, index) { | |
| return { username, hero, index }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment