JavaScript Ninja Secrets ??? ????? ?????? ?? ??? ??? ?? ????.
?????? ???? ?? ???? ?????bind
里面的fn指向myFunction
這個函數(shù) 這個我不太理解 我的理解是只要用Function.prototype
這個原型擴展的方法 此方法里面開始聲明的變量var fn=this;
中fn
的指向就指向使用這個方法的函數(shù) 就像本例中的myFunction.bind(myObject);
調(diào)用bin
方法,fn
指向myFunction
? ??? ???? ?? ???? ??????
?? ??? ? ???? ??? ????? ??? ??? ???????
myFunction.bind(myObject)? ?????? ??? ??? ?????
myFunction? fn? ????, ????? ?? ??? ????, ? ?? ????? ???? ??? ?????.
??? ??? ?? ???? ?? ??? ?? ???? ? ????. ? ??? ???? ??? ??? myFunction.apply(myObject,[...??? ?? ????? ????])
a??()
myFunction.apply(myObject,[...???? ????? ????])
? ?? myFunction ??? ?????. Apply ?? ??? ?? ??? myObject?? ??? myObject==myObject
Return???. ??