Skip to Content
JavaScript Advanced: Code That Holds Up in Production
Advanced
0 likes
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

Sign in to save your progress.

Course Home
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?
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?
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 comment

No comments yet.