I have tried to run it and it did exactly what the question asked for yet FreeCodeCamp don't accept my solution

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function largestOfFour(arr) {
var biggest = 0
var pos = 0
for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr[0].length; j++) {
        if (biggest < arr[i][j]) {
            pos = i
        }
    }
}
return arr[pos]
}
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Safari/605.1.15

Challenge: Return Largest Numbers in Arrays

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.

Hi @tom1209-netizen !

Welcome to the forum!

I would suggest adding this console.log and you will see why your solution is not passing.

console.log(largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]))
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.