JS Basic type & Reference type

Source: Internet
Author: User
1, the basic data types are: Undefined,boolean,number,string,null. The basic type of access is accessed by value, which means that you can manipulate the actual value of the values that are saved in the variable base type comparison is the comparison of the values . When you compare two different types of variables with = =, some type conversions occur. But when two values are of the same type, even = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = That is, reference types can have properties and methods reference types of storage that require memory for both the stack area and the heap area to be completed together. The stack memory holds the variable identifier and pointer to the object in the heap memory, which is accessed by reference when the object is in the address reference type of the heap memory, in other words, compares the address in the heap memory of two objects in the same way. Reference type transfer problem in JS // 直接赋值的话,因为a和b指向同一个地址。所以用哪一个改变值,都会影响a,b。var b = a;// 只能复制一个和a一样的对象,那a和b就指向不同的地址// 下面是jquery复制对象的方法var b = $.extend(true, {}, a); "Attached" 1, jquery Quick Search Handbook: http://www.php100.com/manual/jquery/

JS Basic type & Reference 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.