Function.prototype._bind = function (context, ...args) { let arg = args ? args : []; let _this = this; const fbound = function (...innerArgs) { return _this.apply(this instanceof fbound ? this : context, [ ...args, ...innerArgs, ]); }; fbound.prototype = this.prototype; return fbound; };