JavaScript variable/Type design

Source: Internet
Author: User

The variable types of JavaScript are divided into basic types and reference types. Basic types include: null, Undefined, Boolean, string, number, reference type is Object

The basic type and reference type are accessed in a different way, the former accesses a real memory address, and the latter accesses a reference to the memory address.

var num1 = 5; var num2 = NUM1;

var New Object (); var obj2 = obj1;

The pass parameter when the function is called is passed by value and the memory value of the argument is obtained from the parameter copy. For the base type, the modification of the parameter does not affect the argument, since the copy is followed by two separate memory, and for the reference type, the parameter modification affects the argument, the copy is two references, but points to the same memory.

JavaScript variable/Type design

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.