Execute code in non-strict mode

Is there a way to create a sandbox in a notebook where code strings can be eval()'ed in non-strict mode ?

It’s not sandboxed, but you can eval non-strict code like so:

(1, eval)("this")

If you want the code to be sandboxed, you’ll need to create a sandboxed iframe and run the code inside it.


Thanks Mike.

Figma just published a writeup of the journey towards their new plugin system, and the various sandboxing techniques they looked at (spoiler: they ended up using a Realms shim):

@jashkenas will be excited to learn that they also looked at Duktape, a JS engine compiled to WASM. :grin: