Increment (++) operator solution
Why the n++ operator works this way?\nIf used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value b
# Why the `n++` operator works this way?\nIf used postfix, with operator after operand (for example, `x++`), the increment operator increments and returns the value before incrementing.\n\nThat is why on the first call, the value of `n` is returned, and its value is incremented only after returning from the first call. On the second call we get the `n+1` value and so on.\n\nIf we want to return the incremented value on the first call - use the `++` operator before operand (for example, ++x). The increment operator increments and returns the value after incrementing. Then the first call will return `n+1` and not `n`\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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```
['JavaScript']