Skip to content

Instantly share code, notes, and snippets.

@ancyrweb
Last active January 12, 2022 02:30
Show Gist options
  • Save ancyrweb/972311e68e1eee89226a2d7914a87869 to your computer and use it in GitHub Desktop.
Save ancyrweb/972311e68e1eee89226a2d7914a87869 to your computer and use it in GitHub Desktop.
const elements = [1, 2, 3, 4, 5];
const nextElements = elements.reduce(
(previousValue, currentValue) => previousValue + currentValue,
0
); // 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment