Home  >  Article  >  Web Front-end  >  A brief analysis of the typeof operator in JavaScript_Basic knowledge

A brief analysis of the typeof operator in JavaScript_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 17:11:25855browse

If the operator of typeof is a number, string or Boolean value, the result it returns is "number", "string" or "boolean". For object, array or null, it returns

is "object". For function operands, it returns "function". If the operand is undefined, it will return "undefined".

When the operand of typeof is a wrapper object such as Number, String or Boolean, it returns "object". In addition, for Date and RegExp objects, it also returns "object".

For objects that are not part of the JavaScript core language but are provided by the JavaScript embedded environment, the return value of typeof is implementation determined.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn