This Gist was automatically created by Carbide, a free online programming environment.
Created
March 11, 2019 20:28
-
-
Save carbide-public/2bc7d42bfaf25ca8aa4a71c166b1281a to your computer and use it in GitHub Desktop.
untitled
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
const test = (a, b) => { | |
console.log(b) | |
return a | |
} | |
const cloneFunction = (action, user) => { | |
const clonedAction = action.bind({ }) | |
clonedAction.user = user; | |
return clonedAction; | |
} | |
const cloned = cloneFunction(test, { token : 123 }) | |
cloned.user | |
test.user | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment