Quotes help make search much faster. Example: "Practice Makes Perfect"
Saturday, May 13, 2017
FreeCodeCamp Sum All Numbers In Range Sample Solution
function sumAll(arr) {
var sorted = arr.sort(function(a, b){return a-b});
var sum = 0;
for(var i=sorted[0]; i<=sorted[1]; i++){
sum += i;
}
return sum;
}
No comments:
Post a Comment