easyJS ES5#51

Closure counter factory

Prompt

Write a function createCounter that returns an object with increment and getValue methods. The count variable must be private — enforced via closure, not convention. Two counters created separately must not share state.

Hints

Solution

Your Code

5 min

Tests

Click Run to test your code