Testing for undefined

Benchmark created by Chris Sullins on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
undefined
var yes, no = true;
yes === undefined;
no === undefined;
ready
Non-existent object property
var yes, no = true;
yes === ({}).iAmNotDefined;
no === ({}).iAmNotDefined;
ready
Anonymous function return value
var yes, no = true;
yes === function(){}();
no === function(){}();
ready
typeof
var yes, no = true;
typeof yes === 'undefined';
typeof no === 'undefined';
ready

Revisions

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

  • Revision 1: published by Chris Sullins on