Functionbind
Function.prototype.bind = function () {
var __method = this;
var args = Array.prototype.slice.call(arguments);
var object = args.shift();
return function () {
__method.apply(object, args.concat(Array.prototype.slice.call(arguments)));
}
}
var obj = {
name: 'franky'
},
fn = function (a, b, c, d, e) {
console.log([this.name, a, b, c, d, e]);
}.bind(obj, 1, 2, 3)
fn(4, 5); // franky,1,2,3,4,5