Tell us what’s happening:
Describe your issue in detail here.
Why doesn’t my code pass the automated tests?? When I console.log typeof ‘variable’ it does say ‘number’, when I console.log the input examples I do get the correct output… Can someone tell me what’s wong here:
**Your code so far**
function sumAll(arr) {
let y = [];
let x = arr.slice()
x = x.sort((a, b) => a - b);
y.push(x[0]);
let z = x.reduceRight((b, a) => b - a);
for (let i = 1; i < z; i++) {
y.push(x[0] + i)
}
y.push(x[1]);
y = y.reduce((a, b) => a + b);
console.log(y);
}
sumAll([10, 5]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36
Challenge: Sum All Numbers in a Range
Link to the challenge: