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:
- Use a JavaScript-in-JavaScript interpreter. Some possible options:
- Use a mathematical expression evaluator. Some possible options:
- Build your own scripting language!
- This assumes you like building parsers, lexers, etc., but for those who like doing so, the option is available!