Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
With if statements
179.1M/s
With ternary operator #1
175.6M/s
With inline statements
173.0M/s
With ternary operator #2
172.3M/s
With min() and max()
8.7M/s
View exact numbers
Test name Executions per second
With if statements 179,138,608 Ops/sec
With ternary operator #1 175,599,904 Ops/sec
With inline statements 172,970,464 Ops/sec
With ternary operator #2 172,339,328 Ops/sec
With min() and max() 8,739,488 Ops/sec
Tests: