array.find vs array.findIndex

Benchmark created on


Setup


Test runner

Ready to run.

Testing in
TestOps/sec
find
var arr = [];
var i = 0;

while (i <= 1E5) arr[i] = i++;
const item = arr.find(item => item == 1E5);
ready
findIndex
var arr = [];
var i = 0;

while (i <= 1E5) arr[i] = i++;
const index = arr.findIndex(item => item == 1E5);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.