Last active
September 17, 2015 05:08
-
-
Save bradurani/02f523c9688ad5b62fce to your computer and use it in GitHub Desktop.
Function Injection Brad
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 bradRank(){ | |
... //rate beef tongue very highly | |
} | |
function findBestTacos(rankingFunction, restaurants) { | |
return restaurants.reduce((acc, next) => { return acc.concat(next.tacos) }, []) | |
.sort((a, b) => { rankingFunction(a) - rankingFunction(b) }) | |
.slice(0, 10); | |
} | |
let bradTopTen = findBestTacos.bind(null, bradRank); //returns a function | |
highestRankedForRestaurantsOpenSunday(bradTopTen, restaurants); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment