JavaScript must know (ii) NULL and UNDEFINED_JAVASCRIPT techniques

Source: Internet
Author: User

Null

NULL represents a "null",

Use typeof (null);//object; Indicate that he is a special object.

A null type is only its own unique member. He does not contain attributes and methods.

Undefined

Undefined also means "empty",

The use of typeof (undefined),//undefined, indicates that he is undefined type.

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

Summary

Null and undefined can be the same in the MO, for example, can be converted to a Boolean value, to represent false;

Null and undefined are not available. and [] to take member values, so you should first determine whether the object is null or undefined.

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.