Skip to content

Instantly share code, notes, and snippets.

@irvanherz
Created October 26, 2022 09:15
Show Gist options
  • Save irvanherz/4747fd5456e437a719003db3d2bc5691 to your computer and use it in GitHub Desktop.
Save irvanherz/4747fd5456e437a719003db3d2bc5691 to your computer and use it in GitHub Desktop.
Evaluate function with arguments
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