Last active
November 17, 2020 20:01
-
-
Save ReneSena/b78b14e786b53b29ca92fdf361fce920 to your computer and use it in GitHub Desktop.
Combine function = map, filter and reduce
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
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