Skip to content

Instantly share code, notes, and snippets.

@ReneSena
Last active November 17, 2020 20:01
Show Gist options
  • Save ReneSena/b78b14e786b53b29ca92fdf361fce920 to your computer and use it in GitHub Desktop.
Save ReneSena/b78b14e786b53b29ca92fdf361fce920 to your computer and use it in GitHub Desktop.
Combine function = map, filter and reduce
const numbers = [1,2,3,45,10,4];
numbers
.map(number => number * 2) /*[2,4,6,90,20,8]*/
.filter(number => number > 10) /*[90, 20] */
.reduce((total, number) => total + number); /*110*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment