== versus ===

JavaScript performance comparison

Test case created by Axel Rauschmayer and last updated

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var value = "abc";

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Equals
value == "abc";
pending…
Strict equals
value === "abc";
pending…
typeof ==
typeof value == "string";
pending…
typeof ===
typeof value === "string";
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.

1 Comment

John-David Dalton commented :

Millions of ops/sec vs millions of ops/sec means that there is no real world concern for using one over the other. Use what makes sense. For example when types are like, typeof foo == 'string', the == will do because on like types == and === perform exactly the same steps. The excessive millions of === in Firefox probably has to do with some engine optimization (which may change from version to version), though honestly millions is millions is millions.