Testing Null

Benchmark created by Krinkle on


Description

See also:

  • "Testing Undefined"
  • "Testing Null" (current)
  • "Testing Null or undefined"

A loose comparison to null (double equals signs) returns true to both null and undefined.

Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
jQuery.type
$.type(foo) === 'null';
ready
Null comparison
foo == null;
ready
Null comparison (strict)
foo === null;
ready

Revisions

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