Boolean vs Double Not

Benchmark created by Soulcyon on


Preparation HTML

<script>
  var t1 = false, t2 = "", t3;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Boolean
var r1 = Boolean(t1);
var r2 = Boolean(t2);
var r3 = Boolean(t3);
return r1 == r2 && t1 == r3;
ready
Double Not
var r1 = !!t1;
var r2 = !!t2;
var r3 = !!t3;
return r1 == r2 && t1 == r3;
ready
Single Not
var r1 = !t1;
var r2 = !t2;
var r3 = !t3;
return r1 == r2 && r2 == r3;
ready

Revisions

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

  • Revision 1: published by Soulcyon on