Hi,
Kindly please suggest what to do for my task - https://www.freecodecamp.org/challenges/sum-all-numbers-in-a-range
My JSFIDDLE link - https://jsfiddle.net/jinisner/zou3m85q/
Working fine but same code on FCC Editor -
///=============================
function sumAll(arr) {
var x = Math.min.apply(Math, arr);
var y = Math.max.apply(Math, arr);
for(var i = x; i<=y; i++){
test.push(i);
}
function add(add1,value1){
return add1 + value1;
}
return test.reduce(add,0);
}
sumAll([1, 4]);
//=====================================
Satisfies only one condition of returning a number , please help out here …
Regards