Can I use `eval` or similar functions?


#1

No. eval and similar methods of executing code are disabled. This is for a variety of reasons, including security-related concerns.

This doesn’t, however, prevent you from running arbitrary code – it just means you have to get inventive. Before considering this path, however, be sure to consider whether or not you really need to run arbitrary code, as there may be considerable risks to doing so.

Some options:


Cannot create a JavaScript "Function" object
#2

From my test and understanding, a JS interpreter like https://github.com/NeilFraser/JS-Interpreter (that you mentioned) resorts to the Function type, which is also forbidden in the Adobe XD plugin runtime.

Did I miss something? Is it really possible to interpret JavaScript code within JavaScript without using the eval or Function?


#3

sval works for sure; I’ve used it myself.