Courses
JavaScript Advanced: Code That Holds Up in Production
Check Yourself: Functions That Remember
Five scenario questions on closures and this. If you miss more than one, run the examples again and change one line at a time.
Course content
Join this Course
Sign in to save your progress.
-
Functions That Remember
-
JavaScript Closures in Real Code
-
this, bind and Arrow Functions: Who Is Calling
-
-
-
How JavaScript Actually Runs
-
The Event Loop: Microtasks, Macrotasks and Why setTimeout(0) Isn't Zero
-
Running Promises in Parallel: all, allSettled, race
-
Cancelling Work With AbortController
-
-
-
Data That Doesn't Fit in Memory
-
Iterators and Generators
-
Streams in Node.js: Reading Big Files a Piece at a Time
-
-
-
Catch Bugs Before You Run the Code
-
JSDoc Types and // @ts-check Without Switching to TypeScript
-
ESLint in a Real Project
-
-
-
Ship It, Then Make It Fast
-
Bundling With Vite and Publishing to npm
-
Finding Slow Code With the Performance Profiler
-
Memory Leaks: Event Listeners and Closures That Never Let Go
-
-
- Final Check: JavaScript Advanced
1.
const withTax = amount => amount * (1 + rate); is created while rate is 0.12. Later, rate is changed to 0.2. What does withTax(100) return?
2.
A cart factory keeps items in a closure, but its getItems() method does return items;. What's the problem?
3.
for (var i = 0; i < 3; i++) handlers.push(() => i); then each handler is called. What do you get, and what's the simplest fix?
4.
setInterval(timer.tick, 1000) throws "Cannot read properties of undefined (reading 'seconds')" inside tick. Why?
5.
You add a listener with window.addEventListener("resize", this.onResize.bind(this)) and later call window.removeEventListener("resize", this.onResize.bind(this)). What happens?
About
Five scenario questions on closures and this. If you miss more than one, run the examples again and change one line at a time.
- Duration
- 5 min
- Last update
- 08/25/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.