My challenge involves receiving JavaScript as a string that needs to be executed and compared to a specific output. Currently, I am utilizing the eval()
function for this task, but I am open to alternatives. The execution takes place on the client side within a web browser.
Is there a method to accomplish this without modifying the string a
?
let a = "console.log(\"a\")";
eval(a);
let stdout = ???