Closures and private function state
What does b return on its first call?
Examples
Worked example
Input
Create counters a and b. Call a twice and then b once.
Expected output
1
Hints and solution
Hint 1
Write down the starting state and walk through one example by hand.
Reveal worked answer
Each factory call creates a fresh count of 0. Calling a never changes the separate count inside b.