Array includes vs simple or

Benchmark created by Lucas Taylor on


Setup

var first = 'local';
  var second = 'test';

Test runner

Ready to run.

Testing in
TestOps/sec
includes - match first
['local', 'test'].includes(first);
ready
or - match first
(first === 'local' || first === 'test');
ready
includes - match second
['local', 'test'].includes(second);
ready
or - match second
(second === 'local' || second === 'test');
ready
pass
return
ready

Revisions

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

  • Revision 1: published by Lucas Taylor on