Home  >  Article  >  Web Front-end  >  Summary of undefined learning in JavaScript_javascript skills

Summary of undefined learning in JavaScript_javascript skills

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

When an undeclared variable is used, or a variable that has been declared but not assigned a value is used, or an object property that does not exist is used, this value is returned.

Although undefined and null are not the same, the == operator treats the two as equal, such as

my.prop == null

If the attribute prop does not exist, or it exists but the value is null, then the value of this expression is true.

When an undefined value is used in a boolean environment, it is converted to false, when it is used in a numeric environment, it is converted to NaN, and when it is used in a string environment, it is converted to "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