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
func(p1, p2) obj.child.method(p1, p2)
func.call(context, p1, p2) // this 是 context,这里 context 为 undefined // func.call(undefined, p1, p2) obj.child.method.call(obj.child, p1, p2) // this 是 obj.child
结果不是 undefinded 而是 window,这是因为规定:
call 方法的 context 如果是 null 或 undefined,那就将 context 默认为 window 对象。严格模式下,context 默认为 undefined
https://zhuanlan.zhihu.com/p/23804247
The text was updated successfully, but these errors were encountered:
No branches or pull requests
ES5 中这两个执行函数其实是语法糖
记住!执行时!执行调用时才会牵扯到 this 指向!可看最后那个例子!
其实它们最终是这样的
对于 func.call(undefinded, p1, p2)
结果不是 undefinded 而是 window,这是因为规定:
最后的例子
参考
https://zhuanlan.zhihu.com/p/23804247
The text was updated successfully, but these errors were encountered: