indexOf

Benchmark created on


Description

indexOf test: == vs === vs ~

Preparation HTML

<script>
  var arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
  
  function after() {}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
indexOf ==
if (arr1.indexOf(0) == -1) after()
ready
indexOf ===
if (arr1.indexOf(0) === -1) after()
ready
indexOf ~
if (~arr1.indexOf(0)) after()
ready

Revisions

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