Includes vs IndexOf

Benchmark created on


Setup

let array = [1,2,3,4,5]
let found = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
IndexOf
if( array.indexOf(3) !== -1 )

   ++found;
ready
includes
if( array.includes(3) )

   ++found;
ready

Revisions

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