Last active
May 14, 2018 10:34
-
-
Save jkyberneees/39ee3cc07fc1e40333b0774eb452b5cf 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 N = 2000000 | |
| const items = [] | |
| for (var i = 0; i < N; i++) { | |
| items.push({ index: i }) | |
| } | |
| console.log(items.map(e => e.index).filter(v => v % 2 === 0).reduce((sum, v) => sum += v)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment