Created
February 7, 2017 19:50
-
-
Save BenGitsCode/08d5e34013f208702fcf862c9b11fb0b to your computer and use it in GitHub Desktop.
Chaining array methods (filter and forEach)
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
let someArray = [1,2,3,4,5]; | |
someArray | |
.filter(num => { | |
if(num % 2 === 0) { | |
return num; | |
} | |
}) | |
.forEach(evnNum => { | |
//do something cool | |
// push to an array or something | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment