# Return Largest Numbers in Arrays - Issue

Return Largest Numbers in Arrays - Issue
0

Tell us what’s happening:

For some reason, when the value of -3 is passed through and ASSIGNED to the variable it changes from negative to positive; failing the test case.

``````
function largestOfFour(arr) {
// You can do this!
const numbers = [];
for (let i = 0; i < arr.length; i++) {
let largestNumOfArr = [i][0];
for (let j = 0; j < arr[i].length; j++) {
if(arr[i][j] > largestNumOfArr) {
largestNumOfArr = arr[i][j];
}
}
console.log('Largest Num Var:'+ largestNumOfArr); // Becomes positive
numbers.push(largestNumOfArr);
}
console.log('Largest Num Index:'+ arr[3][1]); // Needs to be negative
console.log('Largest Num List:'+ numbers);
return numbers;
}

largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36`.
``````let largestNumOfArr = [i][0];
This is just setting `largestNumOfArr` to the value of `i`, so for the last sub-array it starts at 3 and no value in the array is greater than `largestNumOfArr` so it never gets reset.