The difference between Null and Undefined in JS

The Undefined type has only one value, undefined. When the declared variable has not been initialized, the default value of the variable is undefined.

The Null type also has only one value, which is null. null is used to represent an object that does not yet exist, and is often used to indicate that a function attempts to return a non-existent object.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326383404&siteId=291194637
Recommended