Tell us what’s happening:
I found the solution to this code and mine is very much similar to what I found, but it is not working… Why?
Your code so far
function largestOfFour(arr) {
// You can do this!
var myArray = [0,0,0,0];
for (var topArray = 0; topArray < arr.lenght; topArray++) {
for (var subArray = 0; subArray < arr[topArray].lenght; subArray++) {
if (arr[topArray][subArray] > myArray[topArray]) {
myArray[topArray] = arr[topArray][subArray];
}
}
}
return myArray;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.0.11780 Safari/537.36
.
Link to the challenge: