why does this code not work am i missing something i looked at several ways of completing this code but i am most familiar with FOR loops. I followed instructions as best as i could yet the code won’t pass any information will be greatly appreciated. If Possible please explain in prose as much as possible as i relate to that more than abstract concepts.
Your code so far
function largestOfFour(arr) {
var biggestNumber = [0,0,0,0];
for (var subArray = 0; subArray < arr.length; subArray++) {
for (var subIndex = 0; subIndex < arr[subArray].length; subIndex++) {
if (arr [subArray][subIndex] > biggestNumber[subArray]) {
biggestNumber[subArray] = arr[subArray][subIndex];
}
}
}
return biggestNumber;
}
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 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge: