indexOf vs OR (v31)

Revision 31 of this benchmark created on


Preparation HTML

<span class="class1 class2">Element</span>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var element = $('span');

Test runner

Ready to run.

Testing in
TestOps/sec
OR
var a = 'war'
if(a === 'war' ||a === 'rew34' || a === 'rewrgdfg' || a === 'war2') {
  console.log("true");
}
ready
indexOf
var a = 'war'
if(['war', 'rew34', 'rewrgdfg', 'war2'].indexOf(a) > -1) {
  console.log("true");
}
ready

Revisions

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