typeof is an operator that is used to identify the type of any object in javascript. It returns a value that is string. So you can compare any string value from returned value of typeof. // Examples ...
// This stands since the beginning of JavaScript typeof null === 'object'; A fix was proposed for ECMAScript (via an opt-in), but was rejected. It would have resulted in typeof null === 'null'.