double-negation-VS-typeof

Benchmark created on


Description

check for undefined in different way

Preparation HTML

<script>
  var c = 'undefined';
  var d = undefined;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
double negation
var e = !! c;
var f = !! d;
ready
typeof
var e = (typeof(c) !== 'undefined') ? true : false;
var f = (typeof(d) !== 'undefined') ? true : false;
ready

Revisions

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