Boolean vs !!

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Boolean
for (var i = 1000; i--;) {
  var a = Boolean(i);
  a = !a;
}
ready
!!
for (var i = 1000; i--;) {
  var a = !! i;
  a = !a;
}
ready
<>
for (var i = 1000; i--;) {
  var a = i > 0;
  a = !a;
}
ready

Revisions

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