Playcode Classic

JavaScript Compiler Online

Run JavaScript online in your browser, with nothing to install. This JavaScript online compiler runs your code when you press Run, and the console shows the output and any errors. Sign in to save your code and share a link. It’s part of Playcode Classic, Playcode’s free code tools.

Free. No account needed to start.

At a picnic table in a playground, a young developer runs his code on a laptop while Play presses a big flame-orange button wired to it; beyond the fence our rocket stands on its pad.

See what your code prints the moment you press Run

console.log, warn, error and info land in the console in order. An error shows its message and stack trace, so you know where to look.

Play reads a long paper ribbon from a little printer through a magnifying glass; the ribbon ends in a green tick.

Catch mistakes before you run

The JavaScript editor suggests names and methods as you type, with the documentation beside them. A mistyped line is underlined before it becomes an error.

Little cartoon bugs scurry out of a laptop screen and Play catches them with a butterfly net, while the young developer laughs.

Stuck? Ask the AI

The editor’s AI chat can write a function, explain a line or fix an error. It uses credits; eligible new accounts get trial credits.

Play turns the crank of a wringer that takes in a tangled knot of coloured lines and lets out a neat striped ribbon, as the young developer smiles with relief.

Watch it run

A minute in the editor: write code, take a suggestion, run it and read the console.

JavaScript examples to try

Add up an order
const items = [
  { name: 'Tea', price: 4 },
  { name: 'Cake', price: 6.5 },
]
const total = items.reduce(
  (sum, item) =>
    sum + item.price,
  0,
)
console.log(total) // 10.5
Wait for a result
const wait = (ms) =>
  new Promise((resolve) =>
    setTimeout(resolve, ms),
  )
async function main() {
  await wait(500)
  console.log(
    'Done after half a second',
  )
}
main()
Sort by name
const people = [
  'Zoe', 'adam', 'Émile',
]
people.sort((a, b) =>
  a.localeCompare(b),
)
console.log(people)
// ['adam', 'Émile', 'Zoe']

Part of Playcode Classic

Playcode began in 2016 as a browser coding environment. This compiler is one of its free code tools, which we now call Playcode Classic.

Playcode today is an AI platform for building and running websites and apps.

Play stands at the open gate of an old playground and presents what lies beyond it: a rocket ready on its launch pad.

Questions people ask

  • Is this JavaScript compiler free?

    Yes. Running code is free and needs no account. Saving and sharing need a free account, which keeps up to three saved projects, public or private.

  • How do I run JavaScript online?

    Open the compiler, write or paste your code and press Run. The console shows what it prints, and any error with its stack trace. You can run JS online from a phone as well.

  • Is it a JS compiler or a JavaScript runner?

    Both names fit. JavaScript is not compiled ahead of time like C: your browser’s engine compiles and runs it as it goes. This JavaScript code runner hands your code to that engine and shows what it prints, which is what most people mean by a JS compiler.

  • Do I need to install anything?

    No. It runs in your browser, on a computer or a phone.

  • Can I use npm packages?

    Yes. Import a package and the editor offers to install it from npm.

  • Does it support TypeScript and JSX?

    The editor compiles both as you type. For TypeScript on its own, try the TypeScript playground.

  • Can I build an HTML page, not only print to the console?

    Yes. Open the JavaScript playground to write HTML, CSS and JavaScript and see the page in a live preview.

  • Is my code private?

    Your code runs in your browser. Projects you save are stored on Playcode. A project you create while signed in starts private on every plan; one you started before signing in stays public until you turn its link off.

  • How is this different from the JavaScript playground?

    Use the online JavaScript compiler to run a snippet and read its output. Use the playground to build something with HTML, CSS and packages and see it in a live preview.

  • Is this compiler part of Playcode?

    Yes. This compiler is part of Playcode Classic, Playcode’s free code tools. Playcode began in 2016 as a browser coding environment. Today it is an AI platform for building and running websites and apps.

More free code tools

Run your first line.

Ракета ждёт с открытой дверью и свободным местом, и Play приглашает тебя внутрь. Высоко в небе удаляется другая ракета.