The stack resolution in JavaScript, which has a relationship with delete.

Source: Internet
Author: User

1, the data in the stack is not deleted arbitrarily.

2, the data in the heap can be deleted arbitrarily.

Note : variables defined with eval ("var a") are stored in the stack.

The Var and function statements have a high priority in JavaScript and need to be pre-executed.

Pre-execution is because you need to calculate the size of the space occupied by local variable pointers in the scope to allocate memory to them.

Things in the stack cannot be deleted at will, so we cannot delete them.

But in some cases variables can also be placed in the heap, such as using Eval to execute the VAR statement to dynamically define variables during the run.

Because the computation of the stack space is calculated before the scope is run, variables that are dynamically defined during the run cannot be inserted into the stack, so they are temporarily allocated to the heap.

Since it is in the heap, we can delete it arbitrarily so that it does not contaminate the other scopes.

The stack resolution in JavaScript, which has a relationship with delete.

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.