---
title: JavaScript
description: Execute code with SpiderMonkey 147 (goccy/spidermonkey-wasm v0.2.6) inside a dedicated Wasm Worker.
---

Package: `@sandbox-workers/javascript`. Code is a script: the value of the last expression is the result. Supports `await`, promises, modern JavaScript syntax, and `Intl`. There are no Web builtins (no `fetch`, `URL`, `Response`, timers); ES modules, Node/npm resolution, and networking are also unavailable. BigInt results become strings ending in n.

TypeScript is accepted automatically — no `language` option, no separate mode. Code is parsed as JavaScript first, so valid JavaScript never changes meaning; only code that fails to parse as JavaScript falls back to stripping TypeScript-only syntax (types, `interface`, generics, `as`/`satisfies`, `enum`, `namespace`, parameter properties). Types are stripped, not checked — a type error still runs like any other JavaScript mistake. `import`/`export` remain unsupported in both dialects.

## Deploy

[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https%3A%2F%2Fgithub.com%2Fsyumai%2Fsandbox-workers%2Ftree%2Fmain%2Ftemplates%2Fjavascript)

Or, after npm publication:

```sh
pnpm dlx @sandbox-workers/cli init javascript my-sandbox
```

See [deployment setup](/deploy) and [Service Bindings](/configuration/wrangler). The template requires a Paid plan and creates no public URL.

## Example

Env vars:

```json
{ "NAME": "world" }
```

Code:

```javascript
const name = process.env.NAME ?? "world";
console.log(`Hello, ${name}!`);
({
  greeting: `Hello, ${name}!`,
  engine: "SpiderMonkey inside WebAssembly",
});
```

Every request gets a fresh engine instance. State does not persist between executions. Consult [limits](/platform/limits) for fuel, memory, and output budgets.

## License notice

Before use or redistribution, review this runtime's [LICENSE](https://github.com/syumai/sandbox-workers/blob/main/packages/javascript/LICENSE) and [THIRD_PARTY_NOTICES.md](https://github.com/syumai/sandbox-workers/blob/main/packages/javascript/THIRD_PARTY_NOTICES.md). Bundled interpreters retain their upstream licenses. The package includes the applicable notices in its `licenses/` directory.
