Home  >  Article  >  Web Front-end  >  js determines undefined variable type using typeof_javascript technique

js determines undefined variable type using typeof_javascript technique

WBOY
WBOYOriginal
2016-05-16 17:32:561147browse

js directly uses

to copy the code The code is as follows:

if(mydata== 'undefined'){
alert("undefined");
}

This is a very low-level error, so:
Copy code The code is as follows:

if(typeof(mydata)=='undefined'){
alert("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