Last active
July 9, 2020 21:54
-
-
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
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 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