看代碼functionA(){this.init();}functintest(){console.log('test');}A.prototype.init=function(){this.test=test.bind(this)//看這里this.prototype.test=test(this)//還是這里}看上面代碼中我標(biāo)記的地方,我想動(dòng)態(tài)綁定一個(gè)外部函數(shù)作為A對(duì)象的方法,init方法里的this是指functionA呢還是A.prototype?
prototype中this的疑問
慕斯王
2019-04-13 08:46:09