Created
March 24, 2018 21:20
-
-
Save r37r0m0d3l/1cfde70a9d5f93922160333cb198755a to your computer and use it in GitHub Desktop.
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 numbers = [10, 20, 30, 40]; | |
| const doubledOver50 = numbers.reduce((finalList, num) => { | |
| num = num * 2; //double each number (i.e. map) | |
| //filter number > 50 | |
| if (num > 50) { | |
| finalList.push(num); | |
| } | |
| return finalList; | |
| }, []); | |
| doubledOver50; // [60, 80] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment