JavaScript is bound to (2 null and undefined)

  • 2021-06-28 08:21:39
  • OfStack

null

null means "empty".

Using typeof; //Object;He is a special object.

The null type has only one member of itself.He does not contain attributes or methods.

undefined

undefined also means "empty".

Using typeof; //undefined;It means he is of undefined type.

The undefined type contains only one member of itself, and it does not contain attributes and methods.

summary

null and undefined can be in a different sense, for example, they can be converted to Boolean values to represent false.

Neither null nor undefined can use.And [] for member values, so you should first determine whether the object is null or undefined.


Related articles: