undefined vs local undefined var

JavaScript performance comparison

Revision 3 of this test case created

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
global undefined
var stuff = 1;

if (stuff === undefined) {
  stuff += stuff; // never reached
}
pending…
local undefined var
var stuff = 1, undefined;

if (stuff === undefined) {
  stuff += stuff; // never reached
}
pending…
void 0
var stuff = 1;

if (stuff === void 0) {
  stuff += stuff; // never reached
}
pending…
typeof
var stuff = 1;

if (typeof stuff === "undefined") {
  stuff += stuff; // never reached
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment