Function.prototype.bind = function() {
var __method = this;
var args = Array.prototype.slice.call(arguments);
var object=args.shift();
return function() {
return __method.apply(object,
args.concat(Array.prototype.slice.call(arguments)));
}
}
i just dont know what use of args.concat(Array.prototype.slice.call(arguments)) , i assume that is arguments which pass to apply .
but when i use this, i got confuse .
function func() {
var args=Array.prototype.slice.call(arguments);
var object = args.shift();
alert(args.concat(Array.prototype.slice.call(arguments)));
}
func(1,2,3); // 2,3,1,2,3