You are reading a single comment by @halemmerich and its replies. Click here to read the full conversation.
  • I have tried to eval some code inside a function and it seems to be running in the global scope and not that of the function.

    var global = "a";
    function test(){
         var local = "b";
         eval('print("global", global)');
         eval('print("local", local)');
    }
    test();
    

    prints:

    global a
    Uncaught ReferenceError: "local" is not defined
    

    Should eval() pick up the local variable?

About

Avatar for halemmerich @halemmerich started