Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
ifs compare
(version: 0)
Comparing performance of:
ifs vs ternary
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = Array.from(Array(10000).keys()); var mode = 'include'; var id = 5000;
Tests:
ifs
var is = (mode === 'exclude' && arr.includes(id)) || (mode === 'include' && arr.length > 0 && !arr.includes(id))
ternary
var is = arr.length ? (mode === 'exclude' ? arr.includes(id) : !arr.includes(id)) : false
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
ifs
ternary
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
array includes vs object key
ifs compare 2
array includes vs object key тест
JS Array IndexOf vs includes vs findIndex vs find 5
Comments
Confirm delete:
Do you really want to delete benchmark?