Created
March 30, 2020 22:37
-
-
Save adam-hanna/bb768d2a67a8bbf84149068840e12c0b to your computer and use it in GitHub Desktop.
Example interpretation of a string, to a function with parameters
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
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