Home  >  Article  >  Web Front-end  >  js uses typeof method to determine undefined type_javascript skills

js uses typeof method to determine undefined type_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:42:021444browse

js determines undefined type

if (reValue== undefined)
{
alert("undefined");
}

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"); 
}

typeof returns a string, there are six possibilities: "number", "string", "boolean", "object", "function", "undefined"

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