Skip to content

Instantly share code, notes, and snippets.

@himynameisdave
Created May 21, 2017 20:05
Show Gist options
  • Save himynameisdave/71252fcbfd3429432ba003d0042f6eeb to your computer and use it in GitHub Desktop.
Save himynameisdave/71252fcbfd3429432ba003d0042f6eeb to your computer and use it in GitHub Desktop.
Reduce your fears about .reduce() - Array.find with reduce 01
const fruits = [
  { name: ‘apples’, quantity: 2 },
  { name: ‘bananas’, quantity: 0 },
  { name: ‘cherries’, quantity: 5 }
];
const thisShitIsBananas = fruits.reduce((accumulator, fruit) => {
  return accumulator
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment