function nextId(ids){
let max = Math.max(ids.join());
console.log(max)
}
nextId([0,1,2,3,5]);
nextId([0,1,2,3,4,5,6,7,8,9,10]);
nextId([1,2,0,2,3,5]);
```
Hello:) Can someone tell me pls, why as a result I get NaN?
function nextId(ids){
let max = Math.max(ids.join());
console.log(max)
}
nextId([0,1,2,3,5]);
nextId([0,1,2,3,4,5,6,7,8,9,10]);
nextId([1,2,0,2,3,5]);
```
Hello:) Can someone tell me pls, why as a result I get NaN?
Maybe a misplaced closing parenthesis?
Sorry. I do not get it.
I see what you were trying to do now.
Remember that join() returns a string, right?
Here’s an example from MDN for handling an array of numbers with Math.max():
const arr = [1, 2, 3];
const max = Math.max(…arr);
Thanks for the help:)