Compare ways to find the maximum value in an array.
const arr = Array.from({length: 10000}, () => Math.random() * 10000);Initializing...
| Test Case | Ops/sec | |
|---|---|---|
| Math.max.apply | | ready |
| Math.max(...arr) | | ready |
| for loop | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.