Skip to content

Commit

Permalink
Time: 46 ms (84.42%) | Memory: 48.6 MB (22.43%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ShatilKhan committed Feb 6, 2024
1 parent fad90af commit 5b4ab06
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 2732-counter/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @param {number} n
* @return {Function} counter
*/
function createCounter(start) {
let count = start;
return function(){
return count++;
}
}

/**
* const counter = createCounter(10)
* counter() // 10
* counter() // 11
* counter() // 12
*/

0 comments on commit 5b4ab06

Please sign in to comment.