Skip to content

Instantly share code, notes, and snippets.

@psynewave
Last active July 9, 2020 21:54
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 psynewave/b8f7a951296fde3cfbb8eafef86607e4 to your computer and use it in GitHub Desktop.
Save psynewave/b8f7a951296fde3cfbb8eafef86607e4 to your computer and use it in GitHub Desktop.
A one line function for summing a series of numbers in an array
const sumOfSeries = arr => (arr.length * (parseInt(arr[0], 10) + parseInt(arr[arr.length -1], 10)))/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment