Null/undefined check

Benchmark created on


Setup

const a = null;
const b = undefined;
const c = 'present';

Test runner

Ready to run.

Testing in
TestOps/sec
null == null
const result = a == null;
ready
null === null
const result = a === null;
ready
null == undefined
const result = a == undefined;
ready
null === undefined
const result = a === undefined;
ready
typeof null === 'undefined'
const result = typeof a === 'undefined';
ready
undefined == null
const result = b == null;
ready
undefined === null
const result = b === null;
ready
undefined == undefined
const result = b == undefined;
ready
undefined === undefined
const result = b === undefined;
ready
typeof undefined === 'undefined'
const result = typeof b === 'undefined';
ready
'present' == null
const result = c == null;
ready
'present' === null
const result = c === null;
ready
'present' == undefined
const result = c == undefined;
ready
'present' === undefined
const result = c === undefined;
ready
typeof 'present' === 'undefined'
const result = typeof c === 'undefined';
ready
typeof undeclared ==='undefined'
const result = typeof d === 'undefined'
ready

Revisions

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