**Tell us what’s happening: i dont understand why my code work only in 4 steps vérification **
Describe your issue in detail here.
**function largestOfFour(arr) {
var maxValue = [0,0,0,0];
for (var i = 0; i < arr.length; i++) {
for(var j = 0; j<arr[i].length; j++) {
if (arr[i][j]> maxValue[i]){
maxValue[i] = arr[i][j];
}
}
}
return maxValue;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);**
function largestOfFour(arr) {
var maxValue = [0,0,0,0];
for (var i = 0; i < arr.length; i++) {
for(var j = 0; j<arr[i].length; j++) {
if (arr[i][j]> maxValue[i]){
maxValue[i] = arr[i][j];
}
}
}
return maxValue;
}
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/106.0.0.0 Safari/537.36 Edg/106.0.1370.52
Challenge: Basic Algorithm Scripting - Return Largest Numbers in Arrays
Link to the challenge: