triple equals vs twice equals

JavaScript performance comparison

Revision 22 of this test case created by

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var testStr = 'test';
  var testInt = 111;
  var testIntSame = 111;
  var testIntDiff = 112;
  var testIntStr = '111';
  var result;

};
</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
if ===
var condition = Math.random() > 0.5;
var result;

if (condition === true) {
  result = true;
} else {
  result = false;
}
pending…
undefined
var condition;
var result;

if (condition === undefined) {
  result = true;
} else {
  result = false;
}
pending…
if
var condition = Math.random() > 0.5;
var result;

if (condition) {
  result = true;
} else {
  result = false;
}
pending…
undefined no
var condition;
var result;

if (condition) {
  result = true;
} else {
  result = false;
}
pending…
void 0
var condition;
var result;

if (condition === void 0) {
  result = true;
} else {
  result = false;
}
pending…

Revisions

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

0 Comments