Skip to content

Instantly share code, notes, and snippets.

@haru01
Last active October 27, 2019 04:25
Show Gist options
  • Save haru01/fa643576bfdb14b6c00a6e6e13b3b808 to your computer and use it in GitHub Desktop.
Save haru01/fa643576bfdb14b6c00a6e6e13b3b808 to your computer and use it in GitHub Desktop.
const result = [1,2,3,4,5,6]
.filter(n => n % 2 === 0)
.map(n => n * n)
.reduce((a, b) => a + b, 0);
console.log(result); // (2*2) + (4*4) + (6*6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment