Skip to content

Commit

Permalink
Merge pull request neetcode-gh#2858 from BraxMassengale/2620-ts
Browse files Browse the repository at this point in the history
Create: 2620-counter.ts
  • Loading branch information
felivalencia3 authored Aug 21, 2023
2 parents ce1396e + 5c2f0e6 commit 4ed2ce4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions typescript/2620-counter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function createCounter(n: number): () => number {
return function() {
return n++;
}
}


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

0 comments on commit 4ed2ce4

Please sign in to comment.