i want to understand why my code is not right?
let myArr = ;
function largestOfFour(arr) {
for (let i = 0; i < arr.length; i++) {
myArr.push(Math.max(…arr[i]));
}
return myArr;
}
i want to understand why my code is not right?
let myArr = ;
function largestOfFour(arr) {
for (let i = 0; i < arr.length; i++) {
myArr.push(Math.max(…arr[i]));
}
return myArr;
}
can you post a link to the challenge?
the problem is the global variable myArr
the fcc tests run in a sequence and because of this the myArr global variable is being updated by each test which results in the next test having the wrong result.