Solution with explanation
Explanation\nThe first time counter is called, it calls the function(n) and just returns the inner function and do nothing. Now after this, everytime the counte
# Explanation\nThe first time counter is called, it calls the `function(n)` and just returns the inner function and do nothing. Now after this, everytime the counter is called, it calls the inner function that was returned from the first call and remembers the argument `n` passed and increments it in every calls.\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n\n    return function() {\n        return n++;\n    };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n */\n```
['JavaScript']