Hi,
thare is a lot to fix, i’ll give you 3 suggestions:
you can’t declare with let a variable inside a loop and next call it outside
(how you did for let longestNumber = [])
You have to return an array, so you have to push items inside of it:
you did: longestNumber = arr[i][j]
you should do: longestNumber.push(arr[i][j])
in your if statement there is: arr[i][j] > longestNumber
but you can’t compare a number with an array, you can do something like: arr[i][j] > longestNumber[0]
next you should try to understand the logic…
happy coding!
So, the question is asking you to find the largest numbers, n-u-m-b-e-r-S in the 4 arrays. Not the largest. But the largest in each array. max(arr1, arr2, arr3, arr4)
So, you have to loop through the 2d array and go through each array and find the largest item in it and add it to the list of largest numbers.
And at the end return the largest numbers array.