JS Playground

A JavaScript playground: write code in one pane and see its output in the other, with each run in a web worker that can be stopped at any time.

A frontend app built by Ananda Rizki. More of them at Labs.

Labs — by Ananda Rizki

JS Playground

App

A two-pane JavaScript scratchpad: the source in one pane, whatever it printed in the other. The code runs in a Web Worker rather than on the page, which is what makes an unbounded loop survivable — a watchdog terminates the thread after two seconds, because terminating it is the only thing that stops a loop that never yields, and every run gets a fresh worker so nothing leaks from one into the next. Output is formatted rather than stringified: Maps, Sets, circular references, sparse arrays and getters each print as themselves, and error line numbers are mapped back to the editor's own numbering. The editor is CodeMirror, with completion scoped to what the sandbox actually exposes instead of the page's globals. Panes stack or sit side by side in either order, and the layout is remembered.

Built with
  • react
  • tailwind
  • codemirror
Related

Built by Ananda Rizki, a software engineer and designer, one of the small web apps he writes for fun.

Explore more apps on Labs