Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
find vs findIndex (Array prototype methods) (compare for inclusion)
(version: 0)
Measuring which is faster: `find(predicate) !== null` or `findIndex(predicate) !== -1`
Comparing performance of:
Array.prototype.find vs Array.prototype.findIndex
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
Array.prototype.find
const includesItem = arr.find(item => item == 1E5) !== null;
Array.prototype.findIndex
const includesItem = arr.findIndex(item => item == 1E5) !== -1;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.prototype.find
Array.prototype.findIndex
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:
find vs findIndex (Array prototype methods)
find vs findIndex (Array prototype methods) with console.log
find vs findIndex (Array prototype methods) - using objects
find vs findIndex vs someeeeeeeeeeeeeeee (Array prototype methods)
Comments
Confirm delete:
Do you really want to delete benchmark?