JavaScript reference type-basic wrapper type (deep understanding of the difference between basic wrapper type and base type)

Source: Internet
Author: User
The Boolean, number, and string explanations are basic types, but the official note is that they are special reference types. As far as I can conclude, these three types are more special, either as basic types or as reference types. Why, see below. Because they can call the new new object. For example: String str =new string ("Hello");. This definition is sufficient to describe the nature of the reference type. Then use typeof (str) to determine that the returned data is object. And when using var str= "Hello"; With TypeOf, the Boolean, number, and string types are also returned, so it is possible to say that these three are basic types. The above two statements, in fact, are two different definition methods, in fact, two concepts, the previous one is a reference type of a Boolean object, Number object, string object declaration, a basic type of Boolean, number, String, It is important to understand these two differences, and it is recommended that you never use a Boolean object, a number object, or a String object declaration of the first reference type.

JavaScript reference type-basic wrapper type (deep understanding of the difference between basic wrapper type and base type)

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.