let obj = {
name: "xuelei"
};
function fn() {
console.log(this);
const fn = () => console.log(this);
}
//call()方法改变函数内this指向
//此时this指向对象obj
fn.call(obj);
2023-10-30 08:02:58
let obj = {
name: "xuelei"
};
function fn() {
console.log(this);
const fn = () => console.log(this);
}
//call()方法改变函数内this指向
//此时this指向对象obj
fn.call(obj);