1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-09-19 17:56:55 +02:00

problems(js): add “2620. Counter”

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2023-05-12 17:30:08 +02:00
parent 19541ce1e7
commit 84885aa0c9
Signed by: mfocko
GPG key ID: 7C47D46246790496

16
problems/counter.js Normal file
View file

@ -0,0 +1,16 @@
/**
* @param {number} n
* @return {Function} counter
*/
var createCounter = function(n) {
return function() {
return n++;
};
};
/**
* const counter = createCounter(10)
* counter() // 10
* counter() // 11
* counter() // 12
*/