<qhelp> <overview>

In ECMAScript 5, the `typeof` operator returns one of the following six type tags: `"undefined"`, `"boolean"`, `"number"`, `"string"`, `"object"`, `"function"`. In ECMAScript 2015, it may additionally return `"symbol"`, while on older versions of Internet Explorer it may return `"unknown"` or `"date"` in certain situations. Comparing it against any other string literal is therefore useless.

</overview> <recommendation>

Carefully examine the comparison in question. If the type tag is simply misspelled, correct it. In some cases, the type tag returned by `typeof` is not sufficiently precise, so you may have to use other type test functions.

</recommendation> <example>

The following code snippet tries to determine whether `a` is an array:

Note that `typeof` is not precise enough to distinguish arrays from other objects, since it returns the type tag `"object"` for both. ECMAScript 5-compatible platforms provide a library function `Array.isArray` that can be used instead:

On older platforms, you can use the technique explained on the Mozilla Developer Network.

</example> <references>

- Mozilla Developer Network: typeof.
- Mozilla Developer Network: Array.isArray().
</references> </qhelp>