I want to eval() some lines of code inside of async function. While the following code is ok,
async function foo() { await foo1(); await foo2(); }
foo() should not necessarily be async, as that has no effect on the execution context of eval. Instead, a possible solution is to wrap your ctxScript in a self-executing async function, like so: eval("(async () => {" + ctxScript + "})()")
foo()
async
eval
eval("(async () => {" + ctxScript + "})()")