curry实现
利用闭包访问上下文对象,把参数记忆起来
获取每层的参数
返回每层的闭包
1 | function curry(){ var args = Array.prototype.slice.apply(arguments) var context = this return function(){ return context.apply(null, args.concat(Array.prototype.slice.apply(arguments))) } } |
Good things are coming !