Created
October 26, 2022 09:15
-
-
Save irvanherz/4747fd5456e437a719003db3d2bc5691 to your computer and use it in GitHub Desktop.
Evaluate function with arguments
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 addFun = ` | |
const [a, b] = arguments | |
return a + b | |
` | |
var func = new Function(addFun); | |
const ret = func.call(null, 1, 2); | |
console.log(ret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment