JavaScript
Node 22

Run JavaScript Online

Execute JavaScript code instantly with Node.js 22 in a secure, isolated sandbox. No setup, no installs — just write and run.

index.js
Output
Click "Run Code" to execute...

About JavaScript

JavaScript is the language of the web, powering both front-end and back-end development. With Node.js, it brings async/await, the npm ecosystem, and full-stack capabilities to server-side programming.

Our sandbox runs Node.js 22 with full standard library and module support.

Sandbox Features

  • Secure execution with Docker + gVisor isolation
  • Node.js 22 with ES modules support
  • Up to 300s execution time (Pro tier)
  • Stdin support for interactive programs
  • REST API for programmatic access
  • No setup or installation required

Use JavaScript with stateful sessions

Open a session once, then call execute repeatedly — variables, files, and installed packages persist between runs. Perfect for code interpreters and REPL-style agents.

# 1. Create a session
curl -X POST https://api.sandboxapi.dev/v1/sessions \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"language":"javascript","idle_ttl":300}'
# → {"id":"sess_abc","language":"javascript",...}

# 2. Execute — first call
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"let x = 42"}'

# 3. Execute again — state carries over
curl -X POST https://api.sandboxapi.dev/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $KEY" \
  -d '{"code":"console.log(x * 2)"}'
Read the sessions docs →

Run Code in Other Languages

Need More? Get API Access

Integrate secure code execution into your own apps with our REST API. Free tier includes 500 executions per month.

Get API Key on RapidAPI