Skip to content

Instantly share code, notes, and snippets.

@adam-hanna
Created March 30, 2020 22:37
Show Gist options
  • Save adam-hanna/bb768d2a67a8bbf84149068840e12c0b to your computer and use it in GitHub Desktop.
Save adam-hanna/bb768d2a67a8bbf84149068840e12c0b to your computer and use it in GitHub Desktop.
Example interpretation of a string, to a function with parameters
const s = "return function foo(msg) {console.log(msg)};";
const F = new Function(s);
let f = F()
f("hello") // console logs the string, "hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment