JavaScript
Closures, this, prototypes, the event loop and async code, the core of every frontend loop.
56 lessons 135 practice questions about 4 hours of reading
Chapter 1, beginner
Foundations
What it is and how it works, the questions every round starts with.
- 02What is the difference between var, let and const?
Lesson, 4 min read, then 3 questions to practise
- 03What is hoisting in JavaScript?
Lesson, 4 min read, then 1 question to practise
- 04What is the difference between == and === in JavaScript?
Lesson, 4 min read, then 4 questions to practise
- 05What is the difference between null and undefined?
Lesson, 4 min read, then 2 questions to practise
- 06What is a Promise in JavaScript?
Lesson, 4 min read, then 6 questions to practise
- 07for...in vs Object.keys vs Object.entries in JavaScript
Lesson, 4 min read, then 4 questions to practise
- 08for...of vs forEach: what is the difference?
Lesson, 4 min read, then 4 questions to practise
- Implement forEach, some, every, find and findIndex polyfills
- Make a Range class and a linked list iterable with Symbol.iterator: spread, for...of and early exit
- Build a lazy nested list iterator with hasNext() and next() that also accepts sets and generators
- Implement mapLimit() / throttlePromises() with maximum N concurrent tasks
- 09Function declaration vs function expression in JavaScript
Lesson, 6 min read, then 3 questions to practise
- 11How do you check if an object has a property in JavaScript?
Lesson, 4 min read, then 1 question to practise
- 12Is JavaScript pass by value or pass by reference?
Lesson, 5 min read, then 3 questions to practise
- 13
- 14preventDefault vs stopPropagation vs stopImmediatePropagation
Lesson, 6 min read, then 6 questions to practise
- Predict event propagation order: capturing, target, bubbling and stopPropagation
- Predict addEventListener results: adding a listener twice, once, capture on removal and stopImmediatePropagation
- Build a synthetic event system with root delegation, capture and bubble phases, and stopPropagation
- Stop clicks inside a portal modal from triggering the parent's onClick
- Predict React event order: capture and bubble handlers, stopPropagation, and native listeners on the same elements
- Implement event delegation for a dynamic list
- 15slice vs splice in JavaScript: what is the difference?
Lesson, 5 min read, then 4 questions to practise
- Predict array mutation results: splice, fill with shared objects, toSorted, with and copyWithin
- Write an Array.prototype.splice polyfill: negative indexes, omitted deleteCount and inserts
- Polyfill toSorted, toReversed, toSpliced and with: change-array-by-copy with holes, negative indexes and no mutation
- Predict string method results: slice versus substring, split with a limit, padStart, replace and at
- 16Synchronous vs asynchronous JavaScript: what is the difference?
Lesson, 6 min read, then 4 questions to practise
- Predict the event-loop order of setTimeout, promises, queueMicrotask and await
- Sequential versus parallel awaits: predict how long each snippet takes, then fix the slow ones
- Predict which errors try/catch catches: timers, async callbacks, unawaited promises and finally
- Predict the log order of await inside forEach, for...of, map with Promise.all, and reduce
- 17What are array-like objects in JavaScript?
Lesson, 4 min read, then 3 questions to practise
- 18What are higher-order functions in JavaScript?
Lesson, 4 min read, then 1 question to practise
- 20What do optional chaining (?.) and nullish coalescing (??) do?
Lesson, 6 min read, then 1 question to practise
- 21What is a callback function, and what is callback hell?
Lesson, 4 min read, then 3 questions to practise
- 22What is an IIFE in JavaScript?
Lesson, 6 min read, then 1 question to practise
- 23What is destructuring in JavaScript?
Lesson, 4 min read
- 25What is lexical scope and the scope chain in JavaScript?
Lesson, 6 min read
- 26What is strict mode in JavaScript?
Lesson, 4 min read, then 1 question to practise
- 27What is the difference between the spread and rest operators?
Lesson, 4 min read
Chapter 2, intermediate
In depth
How it behaves under the hood, and the follow-ups that come next.
- 28What is the event loop in JavaScript?
Lesson, 5 min read, then 4 questions to practise
- Predict nested event loop order: promises that schedule timers, timers that schedule promises, and await in loops
- Predict async function timing: return versus return await, thenables, and extra microtask ticks
- Schedule callbacks with MessageChannel so they run before timers
- Implement LazyMan() with a chainable task queue: eat, sleep and sleepFirst
- 29How does the this keyword work in JavaScript?
Lesson, 4 min read, then 3 questions to practise
- 30What is prototypal inheritance in JavaScript?
Lesson, 4 min read, then 3 questions to practise
- 31Async/await vs promises: what is the difference?
Lesson, 4 min read, then 2 questions to practise
- 32ES modules vs CommonJS: what is the difference?
Lesson, 4 min read, then 4 questions to practise
- Simulate ES module evaluation order: cycles, TDZ errors and slow top-level await
- Build a mini module bundler: resolve imports, build the graph, handle cycles and emit one runnable bundle
- Resolve module specifiers with an import map: imports, trailing-slash prefixes and the most specific scopes
- Simulate tree shaking: follow imports and re-exports, keep side-effectful modules and report what is removed
- 33ES6 classes vs ES5 constructor functions: what changed?
Lesson, 5 min read, then 1 question to practise
- 34Event bubbling vs event capturing: what is the difference?
Lesson, 4 min read
- 35How do you create custom error classes in JavaScript?
Lesson, 5 min read, then 3 questions to practise
- 36How does koa-compose work?
Lesson, 8 min read, then 4 questions to practise
- 38Object.freeze vs Object.seal vs const in JavaScript
Lesson, 6 min read, then 3 questions to practise
- Predict quick-fire results: a detached method, a shadowed let, a shallow Object.freeze, Promise.resolve(fn) and -0
- Predict strict mode versus sloppy mode results: implicit globals, this, frozen objects and arguments
- Predict property-descriptor results: getters and setters through spread, Object.assign, JSON.stringify, structuredClone and Object.freeze
- 39Promise.all vs Promise.allSettled vs Promise.race vs Promise.any
Lesson, 4 min read, then 1 question to practise
- 40Unicode, UTF-8 and UTF-16 explained for JavaScript developers
Lesson, 5 min read, then 5 questions to practise
- Predict string length results for emoji, flags, ZWJ families, skin tones and Devanagari conjuncts: .length, spread, Array.from and Intl.Segmenter
- Implement isWellFormed and toWellFormed: lone surrogates, and a code-point-safe reverse and slice
- Truncate a post to N user-perceived characters with Intl.Segmenter: emoji, ZWJ sequences and Indic conjuncts never split; return remaining count for a composer counter
- Predict number and string quirks: 0.1 + 0.2, rounding, parseInt, big integers and Unicode
- Implement slugify() with Unicode normalization and unique suffixes
- 41What are generators in JavaScript?
Lesson, 4 min read, then 4 questions to practise
- Paginate an API with an async generator that cleans up on early break
- Build a co()-style generator runner: await yielded promises, throw rejections back in and accumulate results
- Build async iterator helpers map, filter, take and toArray that clean up with return()
- Implement a lazy zip() and zipLongest() that close unfinished iterators
- 45What is a Symbol in JavaScript used for?
Lesson, 3 min read, then 1 question to practise
- 46What is currying in JavaScript?
Lesson, 4 min read, then 2 questions to practise
- 47What is memoization in JavaScript?
Lesson, 4 min read, then 2 questions to practise
- 49What is the difference between call, apply and bind?
Lesson, 4 min read
- 50What is the temporal dead zone in JavaScript?
Lesson, 4 min read
- 51What is type coercion in JavaScript?
Lesson, 4 min read
- 52Why should you not extend built-in prototypes in JavaScript?
Lesson, 4 min read
Chapter 3, advanced
Senior level
Trade-offs, edge cases and the questions senior rounds end on.
- 53How does garbage collection work in JavaScript?
Lesson, 4 min read, then 4 questions to practise
- Build a weak-value cache with WeakRef and FinalizationRegistry, and test it with a fake garbage collector
- Find and fix an SPA memory leak with heap snapshots
- Fix a DOM node registry that leaks: callback refs with cleanup functions
- Build a mini React Query: QueryClient, useQuery, prefix invalidation and garbage collection
- 55What are WeakMap and WeakSet used for?
Lesson, 4 min read