I am using
eval() to run a script from a string. Below is the code:
I will get
hello from the console output. I wonder whether I can save the
hello into an variable in the current context. So I am looking for something like this:
const output = eval('console.log("hello")'); // I expect the console output is returned from
But I get an
undefined response. Is there a way for me to do that?