Run JavaScript with a console in a sandbox without network.
Runs in this browser. Nothing is uploaded.
JavaScript playground opens on the JavaScript editor. The starting snippet is const squares = [1, 2, 3].map(n => n * n); console.log(squares); and the HTML is cleared, so the preview is the console. Run preview logs 1, 4, 9. console.log, info, warn, error, debug and table are all redirected to that console, with a cap on how many lines and how long each line can be.
The script runs in a worker, not in the frame’s document. There is no DOM. document, window and a query for the heading do not exist there. The HTML and CSS editors are still available if you switch Editor, and any markup you add is allowlisted the same way as on the HTML playground, but the script cannot read it. The worker is terminated after five seconds, so a tight loop does not hang the tab.
The CSS playground starts on a stylesheet and the specimen HTML. The HTML playground starts on that specimen with empty JavaScript. This page starts from the console. None of them can fetch, open a socket, or navigate. A syntax error is reported on the console.
const squares = [1, 2, 3].map(n => n * n); console.log(squares);
The console shows 1, 4, 9. HTML starts empty, so the frame’s document body has no specimen heading.
No DOM is the constraint. A snippet that works here does not depend on the page that happens to be hosting the frame.
The script runs in a worker. There is no document. console.log is redirected to the preview. The HTML you type is a separate frame the worker cannot touch.
1, 4, 9, from squaring 1, 2 and 3. The HTML editor on this page starts empty.
Up to five seconds. The worker is then terminated. The console also stops accepting lines after a fixed count.
No. The frame blocks network connections, and the worker is started from a blob with no extra permissions.