i dont understand why i got this error
TypeError: Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a Symbol.iterator method.
Your code so far
function largestOfFour(arr) {
for(var i=0; i<arr.length;++i , arr.shift()){
arr.push(Math.max(...arr[i]));
}
console.log(arr);
return arr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
Challenge: Return Largest Numbers in Arrays
Link to the challenge: