Finding greatest element in a 2d array

function largestOfFour(arr) {

let contains = [];

for(let i = 0; i < arr.length; i++){

  for(let j = 0; j < arr.length; j++){

      let max = arr[j].reduce((a, b) => Math.max(a, b));

      contains.push(max);  

  }

  break;

}

return contains;

}

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

Hello @aguerosergio919

Welcome to the forum!
Do you have a question? if so please edit your post and describe the same in the OP.