About JS Basic type string

Source: Internet
Author: User

In JS, there are no types of variables, data types, JS data types are divided into two categories, 1. Base data type (Undefined, Null, Boolean, number, Infinity, Nan, String) 2. Reference type (object): Why the first data type is called the base data type, not the value type, because string is more special. The definition of a string is a reference type, but its operation is a value type, which defines a variable x, assigns the string "abc" to x, at which point X points to the first address of the "ABC" array, and when the x is assigned to Y, the first address of the array is assigned to Y, so that the data in the heap is unchanged. X and Y also point to the first address of the array in the heap, and when you want to modify the value of Y, that is, when you modify the array by Y, the heap will be in the application of a space, the original value is copied into the new array values, modified, by x access is an unmodified string array, through Y access to the modified character array, The string definition is a reference type, which is used for the value type.

About JS Basic type string

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.