The mid-level training then began with a busy start.The first is about variables, the role of variables is to give a data value label name. Note: The naming conventions for variable names, function names, and parameter names in javascript: At least
Study Address: http://www.jianshu.com/p/17a9d85845301. Scope of variable scope LEGB1.1 variablecreating, changing, and locating variable names in a Python program is done in a space where variable names are stored, which we call namespaces, also
var i = 2,x = 5;var fn = function (x) {x + = 3;return function (y) {Console.log (x + +) + y + (--);}};var f = fn (1);F (2);FN (3) (4);F (5);Answer: F (2) = 7; FN (3) (4) = 10; F (5) =>9;Problem Solving Ideas:1. var f = fn (1); equivalent to
4 issues related to this, new, call and apply The principle of this pointer is a very complicated question, and if we illustrate this from the implementation mechanism of this in JavaScript, many friends may become more and more confused, so this
A face test to explain the JS scope in detail
The code is as follows
Copy Code
function foo () {FOO.ABC = function () {alert (' Alibaba ')}THIS.ABC = function () {alert (' Alimama ')}ABC = function () {alert (' Alipay ')}
The value of this is determined at run time
JS in what this represents, this is in the program run according to the context of the environment, can be divided into the following situations.
1. This in the global scope
In the global scope, this
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
Function
The Python function does not have a return statement, and implicitly returns a value of None
A function is a callable object, callable ()
function parameters
Parameters that are passed in when arguments are
Before describing the implementation and use of closures, you need to understand some of the following knowledge points.
Execution context (execution context)
1 console.log (a); // 23 console.log (b); // undefined 4 var b;
The eval global Function Dojo Loader will see one of the following functionsvar Eval_ = new Function (' Return eval (arguments[0); '); function functions run at the top-level scope, but run more efficiently, but using this method does not pollute
Closures and scope chain is a more important concept in JavaScript, these two days to read some information, the relevant knowledge points to the following summary.
JavaScript takes the lexical scope (lexical scoping), where the function execution
Recently because of a project, which involves the JS private method, the concept is very common in its language, many languages have private this keyword, as long as the front of a class plus private means that the declaration of a private method,
This article explains the api development manual of nodejs0.8.8. node. js URL Overview (synopsis) is a simple example of a webserver written with node to output & quot; helloworld & quot;: [javascript] & lt; SPANstyle & quot; FONT-SIZE: 18px;
Next let's look at the function-this magical object. When talking about the internal attributes of a function in the previous article, the internal attribute of this is not explained. However, before talking about this, I want to talk about the
This can be said to be one of the most intriguing features in javascript, just like the tenses in high school English, such as the passive tense, the past tense, the present tense, and the past tense, no matter how many times you miss it, the next
The eval function executes a JavaScript code string in the current scope.
Disguised eval
Security Questions
Conclusion
The eval function executes a JavaScript code string in the current scope.
var foo = 1;function test() { var foo = 2;
Second, scope1. Namespaces (namespaces)In the. cc file, the use of unnamed namespaces is advocated (unnamed namespaces, translator Note: Unnamed namespaces are like unnamed classes, which seem to be introduced rarely:-(). when using a named
Strict mode is a new syntax defined by ECMA-262 Edition 5, indicating that strict Javascript syntax is used to execute, some of the past-used writing will throw a SyntaxError exception, for example:1. var is not declared before the variable2. Use
Python is a static-scoped language, although it is itself a dynamic language. In other words, the scope of the variable in Python is determined by its position in the source code, which is somewhat similar to C, but the difference between Python and
The function of Pythond is written by a new statement, that is, Def,def is an executable statement--the function does not exist until Python has run def.
Functions are passed by assignment, and parameters are passed to the function by
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.