Home > Web Front-end > JS Tutorial > body text

Use typeof method to determine undefined type_javascript skills

WBOY
Release: 2016-05-16 16:36:37
Original
1438 people have browsed it

For js to determine the undefined type, use the typeof method. typeof returns a string, one of which is undefined.

js determines undefined type

if (reValue== undefined)
{
alert("undefined");
}
Copy after login

I found that I couldn’t tell, so I finally checked the information and needed to use the typeof method:

if (typeof(reValue) == "undefined")
{ 
alert("undefined");
}
Copy after login

typeof returns a string, there are six possibilities: "number", "string", "boolean", "object", "function", "undefined".
Be careful when using it.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template