Sum All Numbers in a Range

Tell us what’s happening:

why is it not working???

Your code so far

function sumAll(arr) {
 var A=Math.max(arr[0],arr[1]);
  var c;
  for(var i=A;i!=Math.min(arr[0],arr[1])-1;i--){
    A.push (c);
  return sum.reduce(function(a,b){
    return a+b;

sumAll([1, 4]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:

Chrome devtools console is essential to learning and using Javascript - the console window shows the error in your code

Uncaught TypeError: A.push is not a function at sumAll

the bug is you do not declare sum in the function - instead you treat A as an array in the loop

First initialize sum before the loop - then use it in the loop

let sum=[]
// ...