Skip to content

JavaScript practice

Practice JavaScript online: 10 exercises, graded problems and a playground

JavaScript needs no download at all: your browser already contains a complete JavaScript engine, and that is what runs your code here — inside a sandboxed worker, cut off from the page and the network. The exercises use console.log and a readline() helper for input, so they read like the plain scripts you would run with Node, not like web-page code.

checked exercises
10
graded problems
3
lessons
9
cheat sheet
1

JavaScript practice exercises

How the path works →

In order, each one introducing a single new idea. Press Run to check your answer; hints open one at a time.

  1. Hello, Out Loudconsole.log() puts text on the screen
  2. Name Tagconst gives a value a name you can use again
  3. Party PlannerJavaScript does arithmetic, and whole-number division needs Math.floor and %
  4. Umbrella or Notif/else chooses between two outcomes
  5. Countdowna for loop repeats an action
  6. The Clapping Gamean if inside a for, decided again on every pass
  7. The Scoreboardtemplate literals build text with values inside it
  8. Packing Listan array holds several values in order, and for...of walks through them
  9. Rainfall Weeka value declared with let above a loop carries a running total from pass to pass
  10. The Cafe Ticketassembling a complete program out of parts you already know

Graded JavaScript practice problems

Checked against hidden test cases — the step up from the exercises. Some are debugging labs: the program is already broken, and the job is to find out why.

JavaScript lessons behind the practice

All lessons →

JavaScript cheat sheet

Everyday syntax on one page, for when you remember the idea but not the spelling.

Coding interview questions

Original questions with full model answers, for when the practice is going somewhere specific.

Questions people ask

Which JavaScript engine runs my code?
Your browser's own engine — V8 in Chrome and Edge, SpiderMonkey in Firefox, JavaScriptCore in Safari. Nothing is downloaded, which is why the JavaScript exercises start instantly.
How does reading input work when there is no Node.js?
The sandbox provides a readline() function that returns the next line from the input box beside the editor. It is the one addition to the language you will find here, and the exercises say so wherever they use it.
Is console.log the same as in the browser console?
It prints to the output panel instead of the developer console, and objects are shown as text rather than expandable trees, but the values are the same. That is what the exercises check: the exact lines your program prints.
What comes after the beginner exercises?
After the 10 exercises there are graded practice problems checked against hidden tests, lessons on the ideas behind them, and the TypeScript path if you want types on top of the JavaScript you already know.

Practise another language

The same kind of practice hub exists for Python, TypeScript, Java, C++, C, C#, Go, PHP, Ruby, SQL, R and Bash & the Shell.