Created
May 21, 2017 20:31
-
-
Save himynameisdave/546f4c03ca173220c18693348134963a to your computer and use it in GitHub Desktop.
Reduce your fears about .reduce() - Array.find with reduce 02
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 thisShitIsBananas = fruits.reduce((accumulator, fruit) => { | |
if (fruit.name === 'bananas') return fruit; | |
return accumulator | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment