Easy to understand solution ! !
Intuition\n Describe your first thoughts on how to solve this problem. \n- In the function counter, the n is a local variable so we just use n++ to change the v
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- In the function `counter`, the `n` is a local variable so we just use `n++` to change the value each time.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n- The thing is, `return n++` will return the value of `n` first and then add one.\n# Complexity\n- Time complexity: $$O(1)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1) $$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(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```\n **Hope you like it !**
['JavaScript']