I think it’s because of the way you’re constructing the temporary variables to track the largest number. Your first line, in effect, creates a copy of arr - which is a two-dimensional array. Whereas your ultimate desired answer is supposed to be a one-dimensional array. This leads you to get confused with assignments into the temp variable - for example, in line: temp[i] = arr[i][j];
what you’re getting out of array is a single number and you put it into temp[i] - but before this operation, temp[i] used to contain an array of numbers. This then makes temp[i][0] stop working.
I would suggest you create temp as a single-dimension array instead, maybe initialise it with zeroes, and then update every time when you encounter a number larger than what’s in the array.
UPDATE: I see you changed the code in question slightly - makes this answer not fit your current code.
In your second attempt, you’re not comparing the variable in final with encountered number, but always with the first element in the subarray (temp[i][0]) - that’s what makes you return e.g. 26 instead of 27. Just ditch the temp array and compare directly what you have stored in the final result and update as you go, and you’ll get there
PS: It might help you to add console.log ("Comparing " + arr[i][j] + " to " + temp[i][0]) next to your if statement to see what’s happening.
My solution, although I admit that I peeked into the get hint section but I am amazed that I didn’t figure out this before, I wasn’t updating the value in temp[i][o] in if section and it was staring right at my face, gotta be writing code with full concentration next time