Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Ternary with null choice vs &&
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Ternary with true condition
22910836.0 Ops/sec
Ternary with false condition
23060302.0 Ops/sec
&& with true condition
23032526.0 Ops/sec
&& with false condition
23103980.0 Ops/sec
Script Preparation code:
const foo = "a choice" let result = ""
Tests:
Ternary with true condition
result = true ? foo : null
Ternary with false condition
result = false ? foo : null
&& with true condition
result = true && foo
&& with false condition
result = false && foo