Explain Closures
Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.
The problem
- medium
- Pro
You need a function called makeCounter. Each call to it returns a new counter function, and each time you call a counter it returns the next number, starting at one. Two counters must count independently, and nothing outside should be able to change a counter's number. Explain how you'd build it and why it works.
Talk this problem through with an AI coach
This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.