Is the JS sandbox safe to run untrusted code?+
The sandbox runs in an isolated iframe with restricted access. It cannot access your browser's localStorage, cookies, or make cross-origin requests. It's safe for testing your own code, but don't paste code from unknown sources without reviewing it first.
Can I use npm packages in the sandbox?+
You can import packages via CDN URLs using import() syntax: const _ = await import('https://cdn.skypack.dev/lodash'). This loads the package from a CDN rather than npm install.
What is the difference between this and the browser console?+
The browser console exposes your current page's scope and can manipulate the DOM. This sandbox is a clean isolated environment with no page context - better for testing pure logic without side effects on a live page.
Does it support async/await?+
Yes. Top-level await is supported - you can write await fetch(...) directly without wrapping in an async function. This makes testing APIs and async operations much simpler.
Does the JavaScript sandbox support ES modules?+
You can use dynamic import() to load ES modules from CDN URLs. For example: const { format } = await import('https://cdn.skypack.dev/date-fns'). Static top-level import statements are not supported in the sandbox - use dynamic import() instead.
Can I access the DOM from the JavaScript sandbox?+
The sandbox runs in an isolated iframe with no access to the parent page's DOM. You can use document.createElement and DOM APIs within the sandbox's own iframe context, but you cannot interact with the surrounding page.
Where does console output appear in the sandbox?+
All console.log(), console.warn(), console.error(), and console.table() output appears in the console panel below the editor. Objects are formatted as expandable trees, similar to the browser's DevTools console.
Is there a timeout limit for code execution in the sandbox?+
The sandbox enforces a 10-second execution timeout to prevent infinite loops from locking up your browser tab. If your code exceeds this, it is terminated and an error is shown. Refactor long-running loops to use smaller iterations or async batching.