Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS Array IndexOf vs includes vs findIndex vs find
(version: 0)
Comparing performance of:
indexOf vs includes vs find vs findIndex
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
indexOf
const index = arr.indexOf(1E5);
includes
const included = arr.includes(1E5);
find
const item = arr.find(item => item == 1E5);
findIndex
const index = arr.findIndex(item => item == 1E5);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
indexOf
includes
find
findIndex
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser/OS:
Chrome 135 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
indexOf
128926.2 Ops/sec
includes
129125.2 Ops/sec
find
2887.7 Ops/sec
findIndex
3391.1 Ops/sec
Related benchmarks:
findIndex vs indexOf for simple array 2
JavaScript Benchmark: includes vs indexOf
Array find with indexOf vs includes
JS Array IndexOf vs includes vs findIndex vs find 2
Comments
Confirm delete:
Do you really want to delete benchmark?