findIndex() vs indexOf() on an array

Benchmark created on


Setup

const arr = [1, 2, 3, 'foo', 'bar']

Test runner

Ready to run.

Testing in
TestOps/sec
findIndex()
arr.findIndex(item => item === 'foo')
ready
indexOf()
arr.indexOf('foo')
ready

Revisions

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