-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
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
2021/01/28 - this的理解 #35
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
调用栈
绑定规则
1、默认绑定
考虑如上场景,test1函数是在不带任何引用的形式调用的,因此它是在全局下调用,即适用默认绑定,但前提是在非严格模式下
假如是在严格模式下:
2、隐式绑定
隐式丢失
3、显式绑定
通过call(..) 或者 apply(..)方法。第一个参数是一个对象,在调用函数时将这个对象绑定到this。因为直接指定this的绑定对象,称之为显式绑定
4、new绑定
在使用
new
来调用函数,或者说发生构造函数调用时,会自动执行下面的操作:优先级及判断方法
The text was updated successfully, but these errors were encountered: