The new function cannot reference the local variables of the outer function. When you use new Function(…) (the Function constructor) inside a function, it does not close over its lexical environment: it closes over the global context instead. ![]() The text you eval can reference local variables of the function, and in the non-strict mode, you can even create new local variables by using eval('var foo = …'). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |