# Basic Algorithm Scripting - Return Largest Numbers in Arrays

Tell us what’s happening:
I can’t figure out my code passes all but one test. The failed test condition says should return [25, 48, 21, -3] ; however, it would seem [25, 7, 34, 48] should have returned. I am sure I am overlooking something but I can’t figure out what. I can get past this problem but I just am hoping someone can show me where I have an error in my code.
Thanks in advance for any assistance . I attached a picture without comments to make it cleaner to read.

My comments are in the body of this post if you want to see what I was trying to do.

``````function largestOfFour(arr) {

let largestNumber = [0,0,0,0]; //Creat largestNumber array to hold return values from subarrays

for (let i = 0; i < arr.length; i++) { //Initialize first loop by iterating i through arrays

for (let j = 0; j < arr[i].length; j++) { //Inialize second loop with subArrIndex[j] to iterate through subarrays

if (arr[i][j] > largestNumber[i]) { //If condition will stop testing when arr[i][j] is no longer greater than largestNumber[i]

largestNumber[i] = arr[i][j]; //When "if" condition is met, largestNumber[i] will be equal to arr[i][j].
}
}
}
return largestNumber;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0`

Challenge: Basic Algorithm Scripting - Return Largest Numbers in Arrays

You are checking against `0` but the array has negative values that are less than `0`.
Instead of the elements of this array being `0`, why not make them the first element of each sub array?
The link I gave has something you can use. Or as I/we also suggest, just check against the actual numbers being used instead of `0`.