Last active
June 15, 2019 00:18
-
-
Save benthecoder/fbf7f77d6d81800d424d55c1e084857b to your computer and use it in GitHub Desktop.
This file contains 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
function sumAll(arr) { | |
const max = Math.max(...arr); | |
const min = Math.min(...arr); | |
return((min+max)*(max - min +1)/2); | |
} | |
console.log(sumAll([1,4])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment