Practice Challenges

1. Basic Closure Counter

EasyClosures

Create a function `createCounter()` that returns a function. Each time the returned function is called, it should return an incremented count starting from 1.

No global variables, No side effects, No external dependencies

Closure, Variable, Function

createCounter() -> 1 createCounter() -> 2 createCounter() -> 3

Time: O(1), Space: O(1)

Loading...