1 javascript variable scopes
1.1 function Scopes
There is no block scope: The scope is not surrounded by {} and its scope is determined by the function, so the curly braces in statements such as If/for are not independent scopes.
As mentioned above,
This is the JavaScript
1. Why use this
Let's take a look at an example:
function identity () {return
this.name.toUpperCase ();
}
function speak () {return
"Hello, I ' m" + identity.call (this);
}
var me = {
name: ' Rod Chen '
}
var =
Maybe some experts already know, but I think these two things still have some value, so get here and share it with you
. Have the following code:
Copy Code code as follows:
What does it output when calling this function? It
1.Object class
In JS, object is the base class for all classes, and you can use the object class to create custom objects without having to define constructors (Constructor,prototype,hasownproperty)
var per = new Object ();
Per.name = '
This is one of the most intriguing features in JavaScript, like the tenses in high school English, such as the passive tense, past tense, present tense, past time, and, no matter how many times you miss, the next time you may be mistaken. This
0. BOM vs. DOM Bom:browser object model, which is the absolute core of using JavaScript in the web;
BOM: Provides objects that interact with the browser window, independent of content. The BOM provides a number of objects (Windows, location,
Variable scope (scope) is an easy place to drop holes in python.There are 4 scopes in Python, namely:
L (local) local scope
In functions outside of the E (enclosing) closure function
G (Global) scope
B (built-in)
This article mainly introduces the JavaScript Memory optimization, mainly because javascript applications are getting more and more complex, and memory problems such as choppy and memory overflow become no stranger, so we also talk about memory
Js scopes are used in a variety of ways and different results are produced in a single detail. Next I will summarize some instructions on js scopes. If you need them, please refer to them.
This is an interview question to introduce the js scope in
Scope and scope chain:Reference article: http://www.cnblogs.com/malinlin/p/6028842.htmlHttp://www.cnblogs.com/lhb25/archive/2011/09/06/javascript-scope-chain.htmlhttp://www.zhangyunling.com/?p=134Summarize:①js are objects everywhere.An execution
Show Table of ContentsDirectory[1] definition [2] naming convention [3] declaration [4] attribute [5] scope [6] Declaration elevation [7] Property variablePrevious wordsWith regard to JavaScript, the first important concept is variable, and the
Recently, because of a project, which involves JS static methods and private methods, the concept is very common in its language, many languages have static this keyword, as long as a class in front of a static class to declare the declaration of a
NounEngine: Responsible for compiling and executing the entire JavaScript program from beginning to end.Compiler: Responsible for parsing and code generation .Scope: Collects and maintains a series of queries consisting of all declared identifiers (
Some experts may already know about these two things, but I think these two things still have some value. So I 'd like to share them with you here.
. There are the following
Code :
Copy code The Code is as follows:
what will be output when this
Document directory
Eval function
Execute statement
ExecuteGlobal statement
Eval function
Calculates the value of an expression and returns the result.
[result = ]Eval(expression)Parameters
Result
Optional. Is a variable used to accept the
An adorner (decorator) is an advanced Python syntax. Adorners can be used to process a function, method, or class. In Python, we have several methods for working with functions and classes, such as in Python closures, where we see the function
8.1 Window Object The core object of the BOM is window, which represents an instance of the browser. In the browser, window is an interface through JavaScript that accesses the browser window and is the global object specified by ECMAScript. This
Read a question about the scope of the settimeout, in fact, in the "JavaScript Advanced Programming" also saw, share to you:First summarize the following:One, the this in the deferred execution code in settimeout always points to windowSecond,
There is no concept of block-level scope in JavaScript. This means that the variables defined in the block statement are actually created in the containing function rather than in the statement.Script> for(varI=0; I5; I++) {}alert (i);Script>In the
#一, PHP variable definition: Variables are used to store values, such as numbers, text strings or arrays, V: string/integer/double/array/object
Naming rules:
1. The variable name of PHP is case-sensitive. 2. The variable name must begin with $3,
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.