bind 函数特点,从第一个参数开始为函数参数,第二个为作用域,返回值是一个函数
function mgyBind(fn,context){
var out = Array.prototype.slice(arguments,2)
return function(){
var a = Array.prototype.slice(arguments)
return fn.apply(context,a.concat(out))
}
}
bind 函数特点,从第一个参数开始为函数参数,第二个为作用域,返回值是一个函数
function mgyBind(fn,context){
var out = Array.prototype.slice(arguments,2)
return function(){
var a = Array.prototype.slice(arguments)
return fn.apply(context,a.concat(out))
}
}