Tell us what’s happening:
In the return part of this function, if I remove the [0] it will return the first array, [4, 5, 1, 3]. But how come if I add the [0] to it, this returns the number of arrays within the array? I half understand it has something to do with it being an index, because when I replace it with 3 it will still return 4, but when I replace it with 4 it will return undefined because the index of the array goes up to 3, not 4.
**Your code so far**
function largestOfFour(arr) {
for (let i = 0; i < arr.length; i++) {
return i = arr[i][0]
}
}
console.log(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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
.
Challenge: Return Largest Numbers in Arrays
Link to the challenge: