咕泡M1研發(fā)經(jīng)理領(lǐng)導(dǎo)力特訓(xùn)
示例四
let obj = { a: 1 }function fn(){
? ?console.log( this )
? ?console.log( this.a )}let newFn = fn.bind( obj )newFn()
上述中的?this
?會打印出什么呢?
newFn() === fn.bind( obj )() ==> this === obj ==> this.a === 1
標簽: