Last active
September 17, 2015 04:57
-
-
Save bradurani/6a0c57364e074b47f3e5 to your computer and use it in GitHub Desktop.
Function Injection After
This file contains 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
function tacoRank(taco){ | |
... | |
} | |
function findBestTacos(rankingFunction, restaurants) { | |
return restaurants.reduce((acc, next) => { return acc.concat(next.tacos) }, []) | |
.sort((a, b) => { rankingFunction(a) - rankingFunction(b) }) | |
.slice(0, 10); | |
} | |
findBestTacos(tacoRank, restaurants); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment