this,谁调用指谁
this
构造函数的优先级(访问权限) > 原型链
new 的时候,this 就会指向 new 出来的对象
new
箭头函数
箭头函数相当于 bind,会改变this` 的指向
bind,会改变
箭头函数的 this 是他父级的 this
箭头函数把 this 固定到他父级的同级作用
能改变 this 指向的关键词
bind
apply
call
一般函数 this 指向在执行的时候绑定
箭头函数中的 this 是在定义函数的时候绑定
严格模式
非严格模式下默认指向 window
window
严格模式下传 null 指向 null,不传或者传 undefined 都指向 undefined,即在严格模式下,没有写执行主体,this 指向是 undefined
null
undefined
Last updated 5 years ago