Js variables, scopes, and memory _ basic knowledge

Source: Internet
Author: User
This article mainly analyzes JS variables, scopes, and memory issues in detail, and attaches a lot of examples to help you understand these three concepts. It is a rare article, we hope to help you with the following basic types: undefined, NUll, Boolean, Number, and String. These types occupy a fixed size space in the memory, and their values are stored in the stack space, we access it by value.

(1) Value Type: numerical value, Boolean value, null, undefined.
(2) reference type: object, array, and function.

If the value is a reference value, you must allocate space for this value in the heap memory. Because the size of this value is not fixed (the object has many attributes and methods), they cannot be saved to the stack memory. However, the memory address size is fixed, so the memory address can be stored in the stack memory.

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.