JavaScript learning summarizes the types of data in 1--javascript

Source: Internet
Author: User
1. The base type value occupies a fixed amount of space in memory and is therefore stored in the stack memory for example:
var a=1; var b= "Hello World";
2. Assigning a value of the base type from one variable to another creates a copy of the value, for example:
var b= "JavaScript"; var c=b;
3. The value of a reference type is an object, Save in heap memory 4. A variable that contains a reference type value does not actually contain the object itself, but rather a pointer to the object 5. The value of the reference type is assigned to another variable from one variable, so that the two variables ultimately point to the same object 6. Determine which base type a value is that can use the TypeOf operator, and Determine which reference type a value is available using the instanceof operator for example:
var arr=["abc", "BCD", "XYZ"];
var arr2=arr;//Here the ARR2 actually replicates only the pointers to Arr, which all point to the same array object
Console.log (typeof arr); Object
Console.log (arr2 instanceof Object);
Console.log (arr2 instanceof Array);
All of these results are true because the array is an instance of the JavaScript built-in object array, and all objects are subordinate to the object

JavaScript learning summarizes the types of data in 1--javascript

Related Article

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.