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

Revision 14 of this benchmark created by Raymond on


Setup

var values = [1, true, "c", [],
    {},
    undefined];
    
    var a = values[Math.floor(Math.random() * values.length)],
        b = values[Math.floor(Math.random() * values.length)],
        c = values[Math.floor(Math.random() * values.length)],
        d = values[Math.floor(Math.random() * values.length)],
        e = values[Math.floor(Math.random() * values.length)],
        u;

Test runner

Ready to run.

Testing in
TestOps/sec
typeof undefined
typeof a === 'undefined';
typeof b === 'undefined';
typeof c === 'undefined';
typeof d === 'undefined';
typeof e === 'undefined';
ready
=== undefined
a === undefined;
b === undefined;
c === undefined;
d === undefined;
e === undefined;
ready
=== undefined(local)
a === u;
b === u;
c === u;
d === u;
e === u;
ready
void 0
a === void 0;
b === void 0;
c === void 0;
d === void 0;
e === void 0;
ready
void null
a === void null;
b === void null;
c === void null;
d === void null;
e === void null;
ready

Revisions

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