Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array indexOf vs includes vs some vs filter
(version: 0)
performance comparison of ways to find if an array contains a value
Comparing performance of:
IndexOf vs Includes vs some vs filter
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = ['banana', 'sausage', 'jesus']
Tests:
IndexOf
array.indexOf('sausage') !== 1
Includes
array.includes('sausage')
some
array.some(v => v === 'sausage')
filter
!!array.filter(v=> v === 'sausage')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
IndexOf
Includes
some
filter
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:
IndexOf vs Includes
array -> indexOf vs includes vs some vs filter
array indexOf (gt -1) vs includes vs some
my own array: indexOf vs includes vs some
find vs includes vs indexof
Comments
Confirm delete:
Do you really want to delete benchmark?