Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Windows
Desktop
2 years ago
Benchmark.js
With ternary operator #1
162.4M/s
With if statements
160.7M/s
With ternary operator #2
146.0M/s
With inline statements
116.6M/s
With min() and max()
4.2M/s
View exact numbers
Test name Executions per second
With ternary operator #1 162,430,608 Ops/sec
With if statements 160,734,160 Ops/sec
With ternary operator #2 145,973,264 Ops/sec
With inline statements 116,603,632 Ops/sec
With min() and max() 4,223,339 Ops/sec
Tests: