Skip to content

Commit 4c00d51

Browse files
day 02 task complete
1 parent 076e9ea commit 4c00d51

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

day02/leetcode2620.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// 2620. Counter
2+
// URL -> https://leetcode.com/problems/counter/
3+
4+
/**
5+
* @param {number} n
6+
* @return {Function} counter
7+
*/
8+
var createCounter = function (n) {
9+
return function () {
10+
return n++;
11+
};
12+
};
13+
14+
/**
15+
* const counter = createCounter(10)
16+
* counter() // 10
17+
* counter() // 11
18+
* counter() // 12
19+
*/

0 commit comments

Comments
 (0)