Return largest num algorithm

I feel like i;m not good enough . I basically inspired myself from other sources for almost all alogrithms problems till now. Maybe i just spend too less time on it. Like,if i can’t make it in 5 minutes i start googling it or checking the FCC solution code. Here is the return largest number alogrithm,i couldn/t do it so i basically had to write their solution. Can someone explain me the code,I really don’t understand it.

function largestOfFour(arr) {
  // You can do this!
  var arrays= [];
  for (i = 0 ; i < arr.length;i++){
    var biggestNum = arr[i][0];
    for (var x = 1 ; x < arr[i].length; x++) {
      if (arr[i][x] >biggestNum) { 
        biggestNum = arr[i][x];
      }
    }
    
    arrays[i] = biggestNum;
  }
  return arrays;
}

You have to explain what is the request, what is input and what do you want like output.

Spend more time if you really want to learn. I got caught up in that trap as well and eventually it will catch up to you. Soon you will find a problem (real-world) and there won’t be a guide to help you.

I encourage you to go through the suck and then you will look back and laugh at how simple things tripped you up. Do yourself the favor, your future-self will thank you.

For what it’s worth, this is what I came up with, might be easier to digest…

function largestOfFour(arr) {
  return arr.sort((a, b) => a - b)[arr.length - 1]
}

Hahahahahah thanks sir u really helped me(No sarcasm)
lIl pump and tyler 1haha