Equality operators

JavaScript performance comparison

Revision 13 of this test case created by Terry Anastasiadis

Info

Test for == and === with the same/diff operand types.

Preparation code

<script>
  var str0 = "12",
      str1 = "12",
      strD = "13",
      obj0 = {
      'foo': 'bar'
      },
      obj1 = {
      'foo': 'bar'
      },
      objD = {
      'bar': 'foo'
      }
     
  num0 = 12, num1 = 12, numD = 13;
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Equal strings
str0 === str1;
pending…
(NOT) equal strings
str0 !== strD;
pending…
Equal objects
obj0 === obj1;
pending…
(NOT) equal objects
obj0 !== objD;
pending…
Equal numbers
num0 === num1;
pending…
(NOT) equal numbers
num0 !== numD;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment