Skip to content

Instantly share code, notes, and snippets.

@battmanz
Last active November 26, 2017 21:29
Show Gist options
  • Select an option

  • Save battmanz/5b0327d6cd0732c4e2d78e7b2a93e413 to your computer and use it in GitHub Desktop.

Select an option

Save battmanz/5b0327d6cd0732c4e2d78e7b2a93e413 to your computer and use it in GitHub Desktop.
The necessary setup required to demonstrate currying vs partial application.
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