I tested this in the google chrome console and it seemed to work fine, but when I went to run the test only two of the 4 test arrays passed. Very confused.
function largestOfFour(arr) {
let newArr = [];
let highest = 0;
for (let i = 0; i < arr.length; i++) {
for (let z = 0; z < arr[i].length; z++) {
if (highest < arr[i][z]) {
highest = arr[i][z];
}
}
newArr.push(highest)
}
return newArr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13597.66.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.109 Safari/537.36
.
Challenge: Return Largest Numbers in Arrays
Link to the challenge: