Write JavaScript like a professional: closures, classes, async code, generators, tests and fast, safe data.
- 28 lessons
- 7 units
- 5 h 29 m in all
- £0, for good
what’s inside.
For people who build things on their own and want code that others trust and can change.
JavaScript Level 3 is for people who have finished Levels 1 and 2. In 28 lessons you master closures, classes, modules, promises, generators, testing and performance, with real requests to a practice server along the way. It ends with a level check: a polite request queue you ship yourself.
every lesson goes the same way.
- meet it
- guess first
- your turn
- fix it
- nailed it
unit 1
Scope and closures
Know where every name lives and what a function remembers.
- Where names live10 minPredict which variables a line of code can see, and which it cannot.
- Functions that remember11 minBuild a function that keeps its own private memory between calls.
- Keeping secrets12 minHide data inside a closure so only your own functions can change it.
- Functions that build functions12 minWrite helpers that take a function and hand back a better one.
unit 2
Classes and prototypes
Design your own kinds of object, then see how they work underneath.
- A class is a blueprint11 minWrite one class and build as many objects from it as you need.
- Guarding the inside12 minLock data inside a class and decide exactly what others may see.
- Building on another class12 minMake a new class that inherits everything from an old one, then improves it.
- Prototypes under the hood13 minSee where methods really live and how JavaScript finds them.
unit 3
Errors and tests
Fail loudly, recover gracefully and prove your code works.
- Throwing and catching11 minRaise an error on purpose and recover from it without crashing.
- Your own kinds of error12 minMake error classes that say exactly what went wrong.
- Checking with assertions11 minLet code check your code, including the awkward inputs.
- A tiny test runner12 minRun a whole suite of tests and get a score, even when some crash.
unit 4
Modules and safe data
Split code into tidy parts and stop data changing behind your back.
- One file, one job11 minSplit a program into modules that share only what they choose.
- Named and default exports12 minShare several names from a module, or one main thing, and rename on the way in.
- Data that cannot change11 minFreeze objects so nothing can change them behind your back.
- Change by copying12 minUpdate data by making new copies, so old versions stay safe.
unit 5
Promises in depth
Take full control of code that finishes later.
- Inside a promise12 minBuild your own promises and see exactly when they settle.
- Chains and catches12 minRead and write promise chains, and catch failures anywhere in them.
- All at once12 minSend many requests together and wait for every answer.
- Races and reports13 minStop waiting for slow servers, and report on every request.
unit 6
Generators and streams
Produce values one at a time, even when they come from a server.
- How for...of really works12 minLook inside the loop and make your own objects loopable.
- Generators11 minWrite functions that pause, hand out a value and carry on later.
- Lazy and endless12 minDescribe endless sequences safely and take only what you need.
- Streams from a server13 minLoop over items that arrive page by page from the practice server.
unit 7
Speed and tools
Make code fast, keep it responsive and use the tools professionals use.
- Counting the work11 minSpot slow code by counting its steps, and speed up lookups with a Set.
- Remembering answers12 minNever work out the same answer twice by keeping a cache.
- Waiting for a pause12 minStop a burst of calls from doing the same work again and again.
- Tools of the trade12 minMeet the tools that check, tidy and version professional code.