Undefined learning summary in JavaScript

  • 2020-03-30 00:39:10
  • OfStack

This is the value that is returned when an undeclared variable is used, or when a declared but unassigned variable is used, or when a nonexistent object property is used.

Although undefined and null are not the same, the == operator treats them as equals, such as

My. Prop = = null

The value of this expression is true if the property prop does not exist, or if it does but the value is null.

When an undefined value is used in a Boolean environment, it will be converted to false, when it is used in a numeric environment, it will be converted to NaN, and when it is used in a string environment, it will be converted to "undefined"


Related articles: