JavaScript playground

Press Run to execute main.js in a sandboxed Worker. Open utils.test.js and press Run to run its tests.

Loading the editor…

Stop really stops

Code runs in a dedicated Worker inside a sandboxed frame. An infinite loop never blocks the editor: Stop terminates the Worker at once, and a hard time limit (5 seconds by default, adjustable up to 60) ends anything you forget about.

Reproducible runs

The Deterministic preset seeds Math.random and freezes Date at 2026-01-01T00:00:00Z, so examples print the same output every time, which is useful for teaching and for bug reports. The Strict preset lowers the time limit to 2 seconds.

The Worker has no DOM and no network. Use the website template if you need document or fetch to external hosts.

Questions

Does top-level await work?

Yes, in the entry file.

Which test functions are available?

describe, test/it (with .skip), beforeEach, afterEach and expect with common matchers: toBe, toEqual, toStrictEqual, toThrow, toContain, toMatch, toBeCloseTo, resolves/rejects and more.

Can I use Node.js modules like fs?

No. Code runs in a browser Worker, not Node.js; importing fs reports a clear UNSUPPORTED error.