Hi folks,
i wrote this code in Atom, and there it is working fine. I pasted it to fcc, and there i get a error called “Spread/Rest Operator” is only available in ES6 (‘use esversion:6’) for the two lines:
var min = Math.min(...arr);
var max = Math.max(...arr);
function sumAll(arr) {
var min = Math.min(...arr);
console.log(min);
var max = Math.max(...arr);
console.log(max);
var arrNew = [];
for ( i = min; i < max +1; i++) {
arrNew.push(i);
console.log(arrNew);
}
var sum = arrNew.reduce(function(a, b) {
return a + b;
}, 0);
console.log(sum);
}
sumAll([10, 5]);
Can anybody help me out there please? Many thanks in advance.
eazy