"Type of undefined" vs "=== undefined" (v37)

Revision 37 of this benchmark created on


Setup

var a = 1, b = true, c = "c", d = [], e = {}, u;

Test runner

Ready to run.

Testing in
TestOps/sec
typeof undefined
function x1() {
typeof a == 'undefined';
typeof b == 'undefined';
typeof c == 'undefined';
typeof d == 'undefined';
typeof e == 'undefined';
}

x1();
ready
=== undefined
function x2() {
a === undefined;
b === undefined;
c === undefined;
d === undefined;
e === undefined;
}

x2();
ready
=== undefined(local)
function x3() {
a === u;
b === u;
c === u;
d === u;
e === u;
}

x3();
ready
x4
function x2(undefined) {
a === undefined;
b === undefined;
c === undefined;
d === undefined;
e === undefined;
}

x2(undefined);
ready

Revisions

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