Alibabacloud.com offers a wide variety of articles about mean by scope of variable, easily find your mean by scope of variable information here online.
ObjectiveIn the 12th chapter, in the description of variable objects, we already know that the data (variables, function declarations, and function parameters) of an execution context are stored as attributes in the variable object.
We also know
in the 12th chapter of the description of variable objects, we already know that the data of an execution context (variables, function declarations, and formal parameters of functions) is stored as attributes in the variable object. We also know
PrefaceIn the description of the variable object in Chapter 12th, we already know that the data of the execution context (variables, function declarations, and function parameters) are stored in the variable object as attributes.
At the same time,
Deep understandingJavaScriptSeries ( -): Scope chain(Scope Chain)ObjectiveIn the 12th chapter of the description of variable objects, we already know that the data of an execution context (variables, function declarations, and formal parameters of
All variables have global scope, local variables have local scope (note that the parameters of the function are also local variables)1. In the function body, the local variable takes precedence over the global variable with the same name.My
What is the result of the following program?
Copy Code code as follows:
var foo = 1;
function Bar () {
if (!foo) {
var foo = 10;
}
Alert (foo);
}
Bar ();
The result is 10;
What about the bottom one?
Copy
Variable scope(a) package variables$x = 1Here, $x is a package variable. There are 2 important things to know about package variables:1) If there is no other declaration, the variable is the package variable;2) package variables are always
What is the result of the following program? Varfoo1; functionbar () {if (! Foo) {varfoo10;} alert (foo);} bar (); the result is 10. What about the following? Vara1; functionb () {a10; return; function... SyntaxHighlighte
What is the result of the
What is the result of the following program?
Var foo = 1;Function bar (){If (! Foo ){Var foo = 10;}Alert (foo );}Bar ();
The result is 10;
What about the following?
Var a = 1;Function B (){A = 10;Return;Function (){}}B ();Alert ();
The result is 1.
Document directory
Key points of the syntax analysis tree
You should have written a similar code. In fact, what I want to express here is that sometimes a method definition is 108,000 different from that used. When the method is executed, what
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.