test undefined null check

JavaScript performance comparison

Test case created

Info

This checks the performance of undefined and null checking.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
normal null and undefined check.
function foo( a ) {
  if ( ! a ) return;
}

foo( null );
foo();
pending…
Better check
function foo( a ) {
  if ( typeof a === "undefined" || a === null ) return;
}

foo( null );
foo();
pending…

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

Compare results of other browsers

0 comments

Add a comment