js call 函数

function bb(){
console.log(this.x)
 
}
function cc(){
this.x = 200
}
var p = new cc();
bb.call(p) // 200
 
大概就是换了this 指定 

猜你喜欢

转载自www.cnblogs.com/lao-shi-nan-ren/p/10703331.html