JavaScript notes-Basic types and reference types

Source: Internet
Author: User

1:ECMAScript contains 2 different data types, base numeric types, and reference numeric types. The basic data types are simple data segments, and reference types refer to objects that may consist of multiple values.

1.1: Common basic types: undefined,null,boolean,number,string

1.2: The value of the reference type is the object that is saved in memory. Unlike other languages, JavaScript does not allow direct access to the in-memory location, which means that the object's memory space cannot be directly manipulated, and then

When manipulating an object, it is actually a reference to the action object instead of manipulating the actual object.

2: Copy Variable value

2.1:eg:var numa=5;

var Numb=numa;

NUM1 re-copies a copy to the NUM2 variable, 2 are independent of each other

2.2: Reference type replication

Var obja=new object ();

Obja.name= ' Bloger ';

var Objb=obja;

Both Obja and OBJB point to the same instance, and they refer to the same object in the heap

JavaScript notes-Basic types and reference types

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.