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

Revision 26 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
'use strict';
typeof a === 'undefined';
typeof b === 'undefined';
typeof c === 'undefined';
typeof d === 'undefined';
typeof e === 'undefined';
ready
=== undefined
'use strict';
a === undefined;
b === undefined;
c === undefined;
d === undefined;
e === undefined;
ready
=== undefined(local)
'use strict';
a === u;
b === u;
c === u;
d === u;
e === u;
ready
void 0
'use strict';
a === void 0;
b === void 0;
c === void 0;
d === void 0;
e === void 0;
ready
=== undefined (really local)
'use strict';
var un;
a === un;
b === un;
c === un;
d === un;
e === un;
ready
void 0 2
'use strict';
var un = void 0;
a === un;
b === un;
c === un;
d === un;
e === un;
ready

Revisions

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