✌ Simple O(1) Solution ✌
Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\nJavaScript []\nvar createCounter = function(n) {\n    return function() {\n        
# Complexity\n- Time complexity:\n$$O(1)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n``` JavaScript []\nvar createCounter = function(n) {\n    return function() {\n        return n++;\n    };\n};\n```
['JavaScript']