Checking for definedness

JavaScript performance comparison

Test case created by Axel Rauschmayer

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Checking via !=
var value;

value = undefined;
if (value != null);

value = null;
if (value != null);

value = 123;
if (value != null);

value = 'abc';
if (value != null);

value = {};
if (value != null);
pending…
Checking via !==
var value;

value = undefined;
if (value !== undefined && value !== null);

value = null;
if (value !== undefined && value !== null);

value = 123;
if (value !== undefined && value !== null);

value = 'abc';
if (value !== undefined && value !== null);

value = {};
if (value !== undefined && value !== null);
pending…
Checking for truthiness
var value;

value = undefined;
if (value);

value = null;
if (value);

value = 123;
if (value);

value = 'abc';
if (value);

value = {};
if (value);
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.

0 Comments