Bool check vs typeof

Benchmark created by Vuly on


Setup

var a;
    var level = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Bool
level = !a ? 0 : 1;
ready
typeof
level = typeof a == 'undefined' ? 1 : 0;
ready

Revisions

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