Each programming language, its variables have a certain range of valid, beyond this range, the variable is invalid, which is the scope of the variable. From the point of view of mathematics, it is the field of the independent variable.
Scopes are
Original article Source: http://blog.csdn.net/yueguanghaidao/article/details/9568071#comments
The scope of JS has been a bit confused, and today I accidentally read the JavaScript Authority Guide, was immediately attracted to write really good. I
Any set of statements in a pair of curly braces belongs to a block, and all variables defined in it are not visible outside the code block, which we call a block-level scope.Scope is always a priority in any programming language because it controls
Read "You don't know JavaScript" a book to make a note;Compiler principle:JS is a compiled language, similar to the traditional compilation language, the traditional compilation process is divided into three stages;1. Word segmentation/lexical
Scope is always the most important in any programming language, because it controls the visibility and lifecycle of variables and parameters. Here, we first understand two concepts: block-level scope and function scope.
What is a block-level scope?
Scope is always the most important in any programming language, because it controls the visibility and lifecycle of variables and parameters. Here, we first understand two concepts: block-level scope and function scope.
What is a block-level scope?
Scope is always a priority in any programming language because it controls the visibility and life cycle of variables and parameters. Here, you first understand two concepts: block-level scope and function scope.What is a block-level scope?Any set
(1) Scope
The scope of a variable is the region of the variable that is defined in the program's source code.
1. The lexical scope is used in JS (lexical scope)
A variable that is not declared within any function (which is also considered global
This is a creation in
Article, where the information may have evolved or changed.
1. Block
The block is a pair of curly braces that enclose the declaration and statement. Block = "{" {statement ";"} "}".
In addition to the explicit source block,
1. Related Concepts
Before we begin this note, we need to understand the following concepts.
1.1 Stacks and heaps in the operating system
Note: The heap and stack mentioned here are not the same as the stacks and stack in the data structure.
Let'
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.