JavaScript Practice
Hands-on JavaScript lessons - write real functions, run them instantly, and get checked by real tests.
JavaScript Practice
Twenty-one short, hands-on JavaScript lessons: start with your first variable, build up through closures and classes, debug a real thrown error from its stack trace, revisit arrays and objects with curried functions, set operations, and a combined search, work through a few classic katas (roman numerals, a Caesar cipher, a smallest-common-multiple calculator), then climb into the code that runs clean and is still wrong. Each lesson gives you a task and a Run button - your code is checked against real tests the moment you run it. Everything runs in your browser.
The last six are the ones that bite at work. A thrown error tells you where to
look; these do not get you that. sort() putting 10 before 9 because it
compares text, || overwriting a deliberate 0, a spread copy that still
shares its nested objects, map(parseInt) returning NaN out of nowhere, a
cart total that drifts by a cent, and a capstone where an API sends some
amounts as numbers and some as strings, so + glues them together instead of
adding them up.
Start with lesson 1. You can leave and come back any time - your code is saved locally.
Lessons
21 total- 01 Variables and expressions
- 02 Functions
- 03 Conditionals
- 04 Arrays: map, filter, and reduce
- 05 Objects
- 06 Closures
- 07 Classes and inheritance
- 08 Fix the bug: read the stack trace
- 09 Curry and partial application
- 10 Array set operations
- 11 Object + array combined search
- 12 Roman numeral converter
- 13 Caesar cipher
- 14 Smallest common multiple
- 15 Capstone: shopping cart total
- 16 Fix the bug: sort() quietly sorts numbers as text
- 17 Fix the bug: || quietly eats a real zero
- 18 Fix the bug: one user's edit changes everyone
- 19 Fix the bug: map(parseInt) quietly returns the wrong numbers
- 20 Fix the bug: the checkout refuses a correct total
- 21 Capstone: JSON numbers that arrive as strings