Created
June 16, 2021 05:25
-
-
Save bjangid20/1de9e3e6ca40d2eb4fab17c09313e24a to your computer and use it in GitHub Desktop.
Implement bind in js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.mybind = function (context, ...args1) { | |
let fn = this; | |
return function (...arg2) { | |
fn.apply(context, [...args1, ...arg2]) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment