Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
hmsimha
on Jan 27, 2022
|
parent
|
context
|
favorite
| on:
Poll: Is the leetcode grind necessary to land a hi...
I'd go with `Math.max(...arr)` personally. Math.max is a variadic function, no need to add a reduce into the mix.
roryokane
on Jan 30, 2022
[–]
That implicitly calls Function.prototype.apply(), which will fail if given more arguments than an implementation-specific limit (
https://stackoverflow.com/questions/22747068/is-there-a-max-...
). Looping with reduce() avoids that restriction.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: