> ## Documentation Index
> Fetch the complete documentation index at: https://e2b.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://e2b.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://e2b.manicule.dev/api/mcp.
> Every agent surface: https://e2b.manicule.dev/.well-known/llms-manifest.json

# Run JavaScript and TypeScript code (/docs/code-interpreting/supported-languages/javascript)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 444 · updated: 2026-07-30 -->
Related: [Run bash code](/docs/code-interpreting/supported-languages/bash.md), [Run Java code](/docs/code-interpreting/supported-languages/java.md), [Run Python code](/docs/code-interpreting/supported-languages/python.md), [Run R code](/docs/code-interpreting/supported-languages/r.md)

Use the `runCode`/`run_code` method to run JavaScript and TypeScript code inside the sandbox.
You'll need to pass the `language` parameter with value `javascript` or `js` for JavaScript and `typescript` or `ts` for TypeScript.

<Note>The E2B Code Interpreter supports TypeScript, top-level await, ESM-style imports and automatic promises resolution.</Note>

<CodeGroup>
```js title="JavaScript & TypeScript"
import { Sandbox } from '@e2b/code-interpreter';

// Create a new sandbox
const sbx = await Sandbox.create();

// Install the axios package
await sbx.commands.run("npm install axios");

// Run the code
const execution = await sbx.runCode(`
  import axios from "axios";

  const url: string = "https://api.github.com/status";
  const response = await axios.get(url);
  response.data;
`,
  { language: "ts" }
);

console.log(execution);

// Execution {
//   results: [],
//   logs: {
//     stdout: [ "{ message: 'GitHub lives! (2025-05-28 10:49:55 -0700) (1)' }\n" ],
//     stderr: [],
//   },
//   error: undefined,
//   executionCount: 1,
//   text: [Getter],
//   toJSON: [Function: toJSON],
// }
```

```python title="Python"
from e2b_code_interpreter import Sandbox

# Create a new sandbox
sbx = Sandbox.create()

# Install the axios package
sbx.commands.run("npm install axios")

#  Run the code
execution = sbx.run_code("""
  import axios from "axios";

  const url: string = "https://api.github.com/status";
  const response = await axios.get(url);
  response.data;
""",
    language="ts",
)

print(execution)

# Execution(
#   Results: [
#     Result({ message: 'GitHub lives! (2025-05-28 10:48:47 -0700) (1)' })
#   ],
#   Logs: Logs(stdout: [], stderr: []),
#   Error: None
# )
```
</CodeGroup>
