Beginner es6
A previous click event was rewritten as $(".btn").click(()=>{console.log(this)});This here points to the document, but if When using function, this points to the current element. How to change the point of this?
巴扎黑2017-07-05 11:09:39
The arrow function does not have its own this
at all, but refers to the outer this
阿神2017-07-05 11:09:39
This question is a cliché. In conclusion, the this pointer in the arrow function has been fixed and points to the block-level scope of the current code rather than the caller's scope.
Some related documents:
https://developer.mozilla.org...
http://www.infoq.com/cn/artic...