What are the basic types of JS? What are the reference types? (i)

Source: Internet
Author: User

1. Basic type: string,number,boolean,null,undefined

2. Reference type: Function,array,object------Technical Object Series, typeof () This three type gets the object

Details:

1. All the values of the basic type are stored in the storage area, JS can manipulate the value directly, while all the values of the application type are stored in the heap memory, JS cannot manipulate the value directly, only the Operation property can be changed.

The original data is not affected when the base type is copied, whereas the reference type is copied by copying the pointer, but the pointer is pointing to the same object, so changing one of the two changes;
Schematic diagram is as follows:

Examples are as follows:

var a=1; var b=a;b=2; Cosole.log (a)//1
var a={title: "TestA", Content: "NiceA"}; var b=a;b.title= "Testb"; b.content= "Niceb"; Cosole.log (a.title)// Testb

2. The basic type typeof () can be recognized (except null); application type typeof () all uniformly recognized as Object

For more information on why null conversions are to object, the next chapter will be different when null and undefined

What are the basic types of JS? What are the reference types? (i)

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.