Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Function.prototype.bind = {
  2. bind(thisArg, ...argArray){
  3. let t = this,
  4. a = arguments;
  5. if (typeof t !== "function"){
  6. throw TypeError("Bind must be called on a function");
  7. }
  8. let b = function(){
  9. var a = arguments;
  10. if (this instanceof a.callee){
  11. return new t(...[...argArray, ...a]);
  12. }
  13. return t.apply(thisArg, [...argArray, ...a]);
  14. }
  15. return b.toString = function(){
  16. return t.toString();
  17. }, b;
  18. }
  19. }.bind;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement