Last active
November 6, 2017 05:10
-
-
Save sharmaabhinav/8f80f56d25cf7f6232f9402e99e6421f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 bind (fn, context, params) { | |
| return function callable () { | |
| fn.apply(context, [...params, ...arguments]) | |
| } | |
| } | |
| /* | |
| function foo (a,b,c) { | |
| console.log(this, a,b,c) | |
| } | |
| var obj = {name: 'obj'} | |
| var fooCall = bind(foo, obj, []) | |
| console.log(fooCall(7,8,9)) | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment