Null and Undefine

Source: Internet
Author: User
NULL is an object that represents "none", and a value of 0;undefined is a primitive value that represents "none", and a value of Nan when converted to a number. when the declared variable has not been initialized, the default value for the variable is undefined. Null is used to represent an object that does not already exist, and is commonly used to indicate that a function is attempting to return a nonexistent object. undefined means "missing value", that is, there should be a value here, but there is no definition. The typical usage is:(1) The variable is declared, but when it is not assigned, it is equal to undefined. (2) when calling a function, the argument that should be supplied is not provided, which equals undefined. (3) The object does not have an assigned property, and the value of this property is undefined. (4) When the function does not return a value, undefined is returned by default. null means "No object", that is, there should be no value at all. Typical usage is:(1) as a function parameter, the parameter of the function is not an object. (2) As the end point of the object prototype chain.

Null and Undefine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.