Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
includes vs ifelse
(version: 0)
Comparing performance of:
includes vs if else
Created:
3 years ago
by:
Registered User
Jump to the latest result
Tests:
includes
let tempArr = [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ], [ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 ], [ 41, 42, 43, 44, 45, 46 ] ] let tc1 = tempArr.filter((arr) => arr.includes(28))[0]
if else
let tempArr = [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], [ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ], [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ], [ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 ], [ 41, 42, 43, 44, 45, 46 ] ] let tc2 = tempArr.filter((arr) => (28 > arr[0] && 28 < arr[9]))[0]
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
includes
if else
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:
if(!variable) vs if(variable===undefined) performance
if(typeof <var> ===undefined) vs if(<var>)
lodash isNil vs native isNil with if
if vs && (condition) (false version)
JS if/if vs if/else if with negotiations
Comments
Confirm delete:
Do you really want to delete benchmark?