=== vs == vs truthy

JavaScript performance comparison

Revision 4 of this test case created by Superficial

Preparation code

<script>
  var bol = true,
      num = 10,
      el = document.createElement('div');
</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
eqeq
bol == true ? true : false;
pending…
eqeqeq
bol === true ? true : false;
pending…
truthy
bol ? true : false;
pending…
eqeq num
num == true ? true : false;
pending…
eqeqeq num
num === true ? true : false;
pending…
truthy num
num ? true : false;
pending…
eqeq el
el == true ? true : false;
pending…
eqeqeq el
el === true ? true : false;
pending…
truthy el
el ? true : false;
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