Last active
September 11, 2018 16:38
-
-
Save rafagarcia/a2a2a82d7aab7cbc5448970ad3730e37 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/kixipiqeka
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]; | |
let updatedNumbers = numbers | |
.map((num) => num * 2) | |
.filter((num) => num > 50); | |
let 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; | |
}, []); | |
console.log(updatedNumbers) | |
console.log(doubledOver50) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment