Front:
Although the front of the network, though a lot of Daniel's experience, but the feeling still do not do, in order to thoroughly understand the JS in this knowledge, decided to write another article. Personally, technically, unless you drill into the details, it is difficult to reach a very high level.
Supplement 1:
This cannot be overridden because it is a keyword.
Supplement 2:
Pasting
$ ( function () {$ ( ' button ' ). Click (function () {alert (this ); //this represents native Dom $ (this) ; //represents the current object, this refers to button }) })
This indicates that the current context object is an HTML DOM object that can invoke properties owned by an HTML object, method. $ (this), which represents the context object that is a jquery context object that can invoke the methods and property values of jquery.
Supplement 3:
The point of this is not deterministic at the time of the function definition, only when the function is executed can you determine who the this is pointing to, in fact this is the object that called it , and there are some problems with this sentence. Although most of the articles on the internet say so, although in many cases to understand that there will be no problem, but in fact, that understanding is inaccurate.
Supplement 4:
Alert is also a property of window, which is also a window point. For example, the alert (this) is executed in the window environment and the result is:
[Object Window]
About the addition of this keyword in JS