thisはどこ?問題続き

| | コメント(0) | トラックバック(0)



と思いきや、


prototype.js には bind なる便利メソッドがあるぽい。


その中身はというと、



Function.prototype.bind = function() {
  var __method = this, args = $A(arguments), object = args.shift();
  return function() {
    return __method.apply(object, args.concat($A(arguments)));
  }
}


なるほど!


やっぱ、 apply が正解か。


ほんとはあんまりわかってないけどね!


トラックバック(0)

このブログ記事を参照しているブログ一覧: thisはどこ?問題続き

このブログ記事に対するトラックバックURL: http://pm.11op.net/mt/mt-tb.cgi/8

コメントする