call()方法
时间:2021-09-03 20:08:35
收藏:0
阅读:13
let obj = {
name: "xuelei"
};
function fn() {
console.log(this);
const fn = () => console.log(this);
}
//call()方法改变函数内this指向
//此时this指向对象obj
fn.call(obj);
原文:https://www.cnblogs.com/zhuifeng-/p/15221385.html
评论(0)