== versus ===

JavaScript performance comparison

Test case created by Axel Rauschmayer and last updated

Preparation code

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


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
value == "abc";
Strict equals
value === "abc";
typeof ==
typeof value == "string";
typeof ===
typeof value === "string";

Compare results of other browsers


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.