Understand Null,undefined,nan.

Source: Internet
Author: User
1. Null indicates an object that does not exist, and 0 when it is converted to a value. It means "no object", that is, it should not have a value and is commonly used to indicate that a function is attempting to return an object that does not exist. Null is a special kind of object (reference type), which represents an indeterminate, but from null itself, it is neither an object nor a type. 1. Undefined is a primitive value that represents "none" and is Nan when converted to a value. When the declared variable has not been initialized, the default value for the variable is undefined. Undefined means "missing value", that is, there should be a value here, but there is no definition. 2. When the operation is null and undefined can be converted to false by type, but not equivalent to false. The undefined is equal to NULL, but not fully equal. 3. Nan is a special Number,nan that is unequal to any value and not equal to itself. 4. Typeof and instanceof are often used to determine whether a variable is empty, or what type it is. Typeof is a unary operation, and before a certain operand, the operand can be any type, and the unknown is judged. Instanceof is used to determine whether a variable is an instance of an object, a known match, such as a null instanceof object, and a return value of false, because NULL itself is not an object, nor is it an instance of objects.

Understand Null,undefined,nan.

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.