Skip to content

Instantly share code, notes, and snippets.

@dg92
Created May 13, 2018 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dg92/4e1491f5ae4eee37ca8cb2ef9f713e90 to your computer and use it in GitHub Desktop.
Save dg92/4e1491f5ae4eee37ca8cb2ef9f713e90 to your computer and use it in GitHub Desktop.
// calculate the sum of array elements
const sum = (arr) => arr.reduce((total, item) => total += item, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment