Skip to content

Instantly share code, notes, and snippets.

@jkyberneees
Last active May 14, 2018 10:34
Show Gist options
  • Select an option

  • Save jkyberneees/39ee3cc07fc1e40333b0774eb452b5cf to your computer and use it in GitHub Desktop.

Select an option

Save jkyberneees/39ee3cc07fc1e40333b0774eb452b5cf to your computer and use it in GitHub Desktop.
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