Skip to content

Instantly share code, notes, and snippets.

@BenGitsCode
Created February 7, 2017 19:50
Show Gist options
  • Save BenGitsCode/08d5e34013f208702fcf862c9b11fb0b to your computer and use it in GitHub Desktop.
Save BenGitsCode/08d5e34013f208702fcf862c9b11fb0b to your computer and use it in GitHub Desktop.
Chaining array methods (filter and forEach)
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