A counter with closures
Build counters that each keep their own private value, using a closure.
intermediateJavaScript
The task
Write makeCounter(start) (start defaults to 0). It returns an object with three functions:
increment()adds 1decrement()subtracts 1value()returns the current value
Each counter must keep its own value: changing one counter must not change another. The code that uses it is already written below; don't change it.
Your output should be:
2 1 11 1