Tell us what’s happening:
Well, this works and pass the challenge…but it’s not universal in all scenarios imo.
Is there a way to reference the first value of each sub-array instead of comparing it to negative inf? xD

Your code so far

function largestOfFour(arr) {
let subArr = [-Infinity, -Infinity, -Infinity, -Infinity];
for (let i = 0; i < arr.length; i++)
for (let j = 0; j < arr[i].length; j++) {
if (subArr[i] < arr[i][j])
subArr[i] = arr[i][j];
}
return subArr ;
}
console.log(largestOfFour([[17, 23, 25, 12], [25, 7, 34, 48], [4, -10, 18, 21], [-72, -3, -17, -10]]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0

Challenge: Basic Algorithm Scripting - Return Largest Numbers in Arrays

I wouldn’t use -Infinity.
I would just assume initially the first number I see is the largest. Then loop till I find a bigger one to replace it (storing in a variable as I go the largest one so far)

How about after the first for loop? (As I is defined there? And because it represents the loop of arrays?)

ps. Your variable names are not great.
If the first variable is supposed to be the largest num, then just call it that largestNum or just l even.
If the second is meant to be the return array then just call it that too retArr or just r.