Why is that not working? It does not work if the bigger number is 10 or above , why is that?
Your code so far
function sumAll(arr) {
arr.sort();
var newa =0;
for(let i = arr[0];i<arr[1]+1;i++){
newa+=i;
}
return newa;
console.log(newa);
}
sumAll([5, 9]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sum-all-numbers-in-a-range/