Skip to content

Commit

Permalink
Time: 54 ms (36.24%), Space: 48.9 MB (40.16%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantoniochacon committed Jun 14, 2024
1 parent 80ad38d commit 61d62de
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 2620-counter/2620-counter.js
Original file line number Diff line number Diff line change
@@ -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
*/

0 comments on commit 61d62de

Please sign in to comment.