Tell us what’s happening:
Something wrong with my code, I can’t find what it is.
Your code so far
function largestOfFour(arr) {
// You can do this!
var largest = [];
for (var i = 0; i < arr.length; i++) {
for (var j = 0; i < arr[i].length; j++) {
var curLargest = arr[i][0];
if (arr[i][j] > curLargest) {
curLargest = arr[i][j];
largest.push(curLargest);
}
}
}
}
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 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/return-largest-numbers-in-arrays/