Tell us what’s happening:
Describe your issue in detail here.
Hey everyone…I need help on this…someone please to give me feedback on my code so far and why the logic isnt working…Thanks a lot. Your code so far
Why are you using <= there? Remember that arrays are 0 indexed so the highest index will actually be 1 less than the length. Also, why do you have i++ at the end of your loop, you already have it here? You have the same problems with your j loop.
if(arr[j] == Math.max(arr[j])){
I don’t think this is doing what you think. First, don’t use == - you almost always want ===. Next, is arr[j] what you want here? Remember that this is an array of arrays. Also, that’s not how Math.max works. You could use it here to simplify this code, but not like that.
return largestArr.push(arr[j]);
Also, remember that return exits the current function. Period. And what value does push return? Google “mdn array push” - that is a good habit to get into.
If I’m having trouble on something, I usually build it in steps. The first step might be to get my loops to work right and see if I can log out the values of the arrays, one by one.