```
function largestOfFour(arr) {
let res = [];
for (let i = 0; i < arr.length; i++) {
let biggestNumer = arr[i][0];
for (let j = 1; j < arr[i].length; i++) {
if (arr[i][j] > biggestNumer) {
biggestNumer = arr[i][j];
}
}
res[i] = biggestNumer;
}
return res;
}
```

can you link to the problem

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`

) to add backticks around text.

See this post to find the backtick on your keyboard.

**Note:** Backticks (`) are not single quotes (’).

Thanks a lot, this is my first time posting here.

The function `Math.max()`

will return the largest number in a given list so if you spread on array out as such `Math.max(...[1,2,3])`

it would return 3.

Yeah i know about that but in the solutions they gave us this

```
function largestOfFour(arr) {
var results = [];
for (var n = 0; n < arr.length; n++) {
var largestNumber = arr[n][0];
for (var sb = 1; sb < arr[n].length; sb++) {
if (arr[n][sb] > largestNumber) {
largestNumber = arr[n][sb];
}
}
results[n] = largestNumber;
}
return results;
}
```

So how is this any different from my solution?

```
function largestOfFour(arr) {
return arr.map(e => Math.max(...e));
}
```

functionally they are the same, but it is more compact

Your function works well and you may not be familiar with higher level functions yet, but freecodecamp will teach you them

But that is the problem, my function is not working I am getting an error:

TypeError: Cannot read property ‘length’ of undefined

I don’t know what is wrong with my code

Your increminting has a typo.

Thank you very much. How did I not see that