We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
资料来自《你不知道的js上》这篇其实是学习笔记
this 是在函数运行时进行绑定的,并不是在编写时绑定,它的上下文取决于函数调 用时的各种条件。this 的绑定和函数声明的位置没有任何关系,只取决于函数的调用方式。
function foo() { console.log( this.a ); } var obj = { a: 2, foo: foo }; var a = "oops, global"; // a 是全局对象的属性 setTimeout( obj.foo, 100 ); // "oops, global"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
this
资料来自《你不知道的js上》这篇其实是学习笔记
this到底是什么
this 是在函数运行时进行绑定的,并不是在编写时绑定,它的上下文取决于函数调 用时的各种条件。this 的绑定和函数声明的位置没有任何关系,只取决于函数的调用方式。
按照以下优先级来判断this
var bar = new foo()
var bar = foo.call(obj2)
var bar = obj1.foo()
var bar = foo()
有趣的小栗子
The text was updated successfully, but these errors were encountered: