JavaScript & TypeScript Online Compiler
Write, run and debug JS or TS snippets — safely sandboxed, nothing to install.
Ctrl+Enter (⌘+Enter) runs. Tab indents; press Esc, then Tab, to leave the editor. Your code is kept in this browser.
Output
Connecting to the code sandbox…
JavaScript output
Sucrase removes the types and turns JSX into React.createElement calls, keeping line numbers. It does not check types.
About the JavaScript & TypeScript Online Compiler
Type or paste JavaScript, TypeScript, JSX or TSX and press Run. console.log, console.table, warnings and errors appear below the editor, together with the value of the last expression and how long the run took. An uncaught error shows its type, message and line — select it to jump to that line in the editor.
The code runs in your browser’s own JavaScript engine, inside a fresh Web Worker on a separate, isolated MySmartCoPilot sandbox origin, so a snippet can never touch this page, your data on this site or your other tabs. An endless loop is no problem either: Stop ends the run at once, and every run has a time limit. TypeScript and JSX are converted to JavaScript with Sucrase first — and Convert to JavaScript gives you that output to copy, so the page doubles as a TypeScript-to-JavaScript converter.
How to use it
- Choose the language (JavaScript, TypeScript, JSX or TSX), or pick one of the examples. Opening a
.js,.ts,.jsxor.tsxfile picks the language for you. - Write your code. The editor indents, closes brackets and highlights syntax; Ctrl+F (⌘+F) searches. To move on from the editor with the keyboard, press Esc and then Tab.
- Press Run or Ctrl+Enter (⌘+Enter). Output appears as the program produces it. Stop ends a run that takes too long; the time limit (10 seconds by default) ends it automatically.
- If there is an error, select its location (for example
main.ts:7:13) to jump to the line. For TypeScript, open JavaScript output to see and copy the converted code.
Examples
const name = 'world';
console.log(`Hello, ${name}!`);
[1, 2, 3].map((n) => n * 2);Hello, world! Result: [ 2, 4, 6 ]
interface User { id: number; name: string }
const users: User[] = [{ id: 1, name: "Asha" }];
console.log(users.map((u) => u.name));
const users = [{ id: 1, name: "Asha" }];
console.log(users.map((u) => u.name));Types are removed and the interface’s line is left empty, so every line keeps its number and errors point to the right line of your TypeScript. The code that is left is unchanged.
Common uses
- Trying out a JavaScript feature, a regular expression or an array method before putting it in your project.
- Learning JavaScript or TypeScript: run examples and see exactly what each line prints.
- Converting a TypeScript snippet from documentation or Stack Overflow into plain JavaScript.
- Checking
Intlnumber and date formatting, or howasync/awaitand timers interleave.
What the runner supports
- Everything your browser supports in a Web Worker: modern JavaScript syntax,
async/await(also at the top level),fetch, timers,crypto,Intl,TextEncoder,structuredClone, typed arrays,BigInt,WebAssembly. console.log,info,warn,error,debug,table,group,time/timeEnd,countandassert, formatted like Node.js ([ 1, 2, 3 ],{ a: 1 },Map(1) { … }).- Like Node, a run ends when your code, its result promise and every timer or
fetchit started have finished; an uncaught exception or unhandled rejection ends it with an error. - With top-level
awaitthe code runs as the body of an async function: usereturnto produce a result.
What it does not do
- No web page:
document,windowand the DOM do not exist in a worker. For code that changes a page, use the HTML, CSS & JS Playground. - No Node.js:
require,fs,processand npm packages are not available, andimport/exportstatements are not supported (the code runs as a script). - No type checking: TypeScript types are removed, not checked, so a type error does not stop the code from running. Run
tscin your project for type errors. - JSX becomes
React.createElement(…)calls, so the code has to defineReact— the TSX example shows a small stand-in.
Limitations
- Output is limited to 200,000 characters per run; longer output is cut with a note.
- Time limit from 5 seconds to 2 minutes per run.
- Code up to 300,000 characters is saved in this browser (local storage), so it is still there next time; Reset clears it. It is not synced to other devices.
- Needs an internet connection the first time, to load the sandbox frame.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot. Your code runs in an isolated sandbox frame that is loaded from mysmartcopilot-sandbox.pages.dev, a separate MySmartCoPilot address; the code is handed to it inside your browser and never uploaded. Requests your own code makes (fetch) go straight from your browser to the addresses it uses.
Frequently asked questions
Is my code uploaded or stored on a server?
No. The code goes from this page to the sandbox frame inside your browser and runs on your device. It is kept only in your browser’s local storage, so it is there when you come back. If your own code calls fetch, those requests go directly to the addresses it names.
Which JavaScript version does it run?
Whatever your browser supports: V8 in Chrome and Edge, SpiderMonkey in Firefox, JavaScriptCore in Safari. New syntax works as soon as your browser has it. TypeScript and JSX syntax is converted by Sucrase, which handles current TypeScript syntax such as enums, generics, satisfies and parameter properties. Class decorators are left in place, so they only run where the browser itself supports decorators.
Why does document or window not exist?
The code runs in a Web Worker, which has no page to draw on. That keeps runs isolated and lets Stop end them instantly. To work with HTML elements and events, use the HTML, CSS & JS Playground.
How do I convert TypeScript to JavaScript?
Choose TypeScript (or TSX), paste the code and press Convert to JavaScript. The result appears under JavaScript output, ready to copy or download as main.js. Nothing runs when you only convert.
Why did my code stop with a time-limit message?
It was still running when the time limit was reached — usually a loop whose condition never becomes false, or a timer that keeps scheduling itself. Choose a longer limit next to the Run button if the work really takes longer.