|
|
|
|
|
by emptysea
1772 days ago
|
|
Got to be careful with the argument spread, since depending on the JS engine and how large the `list` is, you can end up with a RangeError e.g., Math.max(...Array(100_0000).fill(0))
results in: Uncaught RangeError: Maximum call stack size exceeded
|
|
It's not at all clear to me why this would be a necessary limit to exist, as functions can't reasonably have more than a few hundred formal parameters so passing 100,000 would always imply using unspread or arguments on the receiver, which could surely trivially handle arbitrarily sized arrays.