diff --git a/2620-counter/2620-counter.js b/2620-counter/2620-counter.js new file mode 100644 index 0000000..ef80f10 --- /dev/null +++ b/2620-counter/2620-counter.js @@ -0,0 +1,17 @@ +/** + * @param {number} n + * @return {Function} counter + */ +var createCounter = function(n) { + + return function() { + return n++; + }; +}; + +/** + * const counter = createCounter(10) + * counter() // 10 + * counter() // 11 + * counter() // 12 + */ \ No newline at end of file