undefined (v12)

Revision 12 of this benchmark created by Anders Ringqvist on


Setup

var x;

Test runner

Ready to run.

Testing in
TestOps/sec
x === undefined
x === undefined

/*
One should know that it´s not safe to use the global
variable undefined as it is writeable before ES5.
*/
ready
typeof x === 'undefined'
typeof x === 'undefined'
ready
x === void 0
x === void 0
ready
!x
!x

/* This actually checks if x is falsy. */
ready
null
x == null
ready
[][0]
x === [][0]
ready
{}.x
x === {}.x
ready
x == undefined
x == undefined

/*
One should know that it´s not safe to use the global
variable undefined as it is writeable before ES5.
*/
ready
typeof x == 'undefined'
typeof x == 'undefined'
ready
'undefined' == '' + x
'undefined' == '' + x
ready
'undefined' === '' + x
'undefined' === '' + x
ready

Revisions

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