undefined (v11)

Revision 11 of this benchmark created by Anders Ringqvist on


Preparation HTML

<script>
  var x;
</script>

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.