Created
August 28, 2022 06:10
-
-
Save tk42/800860aa8a3759c01df6ef8ef2ff99cb to your computer and use it in GitHub Desktop.
serialize/deserialize function in JS code
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
function foo(message: string) { | |
alert(message); | |
return 'Hello, serialised world!'; | |
} | |
var storedFunction = foo.toString(); | |
var actualFunction = new Function('return ' + foo.toString())() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment