Iterators and Generators
- Iterators. An iterator is any object whose next() hands back the following value: the protocol for...of quietly speaks.
- Generators. A generator function pauses at each yield and resumes on demand, writing an iterator as straight-line code.
- Lazy sequences. Generators are lazy: values are produced only when asked for, so an infinite sequence costs nothing until read.
Symbols, Maps, Sets and Advanced Collections
- Map. A Map keeps key–value pairs where keys can be anything: objects included: with size and insertion order kept honestly.
- Set. A Set stores each value at most once, making “have I seen this?” a one-call question.
- Symbols. A symbol is a unique key nothing else can collide with: how the language marks protocols like Symbol.iterator.
Functional and Declarative Patterns
- Pure functions. A pure function reads only its inputs and changes nothing outside: same arguments, same answer, every time.
- Immutability. Immutable updates build a new object with spread instead of editing the old one, so past states stay trustworthy.
- Declarative style. Declarative code says what you want: filter then map: while imperative code narrates every index and swap.
Before and after this level
- Before: Level 11: Networking & Data: HTTP Requests and Fetch, JSON and External APIs, Streaming and Realtime Concepts.
- Next: Level 13: Runtime & Memory: Call Stack, Heap and Garbage Collection, References and Memory Behaviour, Finding Memory and Runtime Problems.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does JavaScript Level 12: Advanced Language Patterns cover?
Iterators and Generators, Symbols, Maps, Sets and Advanced Collections, Functional and Declarative Patterns: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 11: Networking & Data, which covers HTTP Requests and Fetch, JSON and External APIs, Streaming and Realtime Concepts.