Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array .indexOf vs .some vs .includes
performance comparison of ways to find if an array contains a value
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
IndexOf
29088640.0 Ops/sec
Includes
28771246.0 Ops/sec
some
29511646.0 Ops/sec
Script Preparation code:
var array = ['cat', 'house', 'ate', 'bingo', 'mango', 'crypto', 'trump', 'banana', 'sausage', 'jesus']
Tests:
IndexOf
array.indexOf('sausage') !== 1
Includes
array.includes('sausage')
some
array.some(v => v === 'sausage')