Figma has a series of blog posts on sandboxing Javascript in the browser for their plugins API:
https://www.figma.com/blog/how-we-built-the-figma-plugin-sys...
https://www.figma.com/blog/an-update-on-plugin-security/
tl;dr they use QuickJS via WebAssembly at the moment.
https://github.com/maple3142/wasm-jseval
But yes, outside of escapes like that, it should be safe to run arbitrary JS via this mechanism.
Figma has a series of blog posts on sandboxing Javascript in the browser for their plugins API:
https://www.figma.com/blog/how-we-built-the-figma-plugin-sys...
https://www.figma.com/blog/an-update-on-plugin-security/
tl;dr they use QuickJS via WebAssembly at the moment.