commit 035db216445f1e046d74d041ddfb1068f72b1014 parent fc7eb91d22820f3dbf962f377d9c2cda9787f4e5 Author: Dimitrije Dobrota <mail@dimitrijedobrota.com> Date: Sat, 6 May 2023 11:47:17 +0200 JavaScript Challenge: Day 2 Diffstat:
A | Problems/2620.js | | | 16 | ++++++++++++++++ |
M | README.md | | | 1 | + |
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Problems/2620.js b/Problems/2620.js @@ -0,0 +1,16 @@ +/** + * @param {number} n + * @return {Function} counter + */ + +var createCounter = function(n) { + return function() { + return n++; + }; +}; + +var createCounter = function(n) { + return () => n++; +}; + +var createCounter = (n) => () => n++; diff --git a/README.md b/README.md @@ -535,3 +535,4 @@ for solving problems. | 2492 | Medium | [Minimum Score of a Path Between Two Cities](Problems/2492.cpp) | | 2497 | Medium | [Maximum Star Sum of a Graph](Problems/2497.cpp) | | 2667 | Easy | [Create Hello World Function](Problems/2667.js) | +| 2620 | Easy | [Counter](Problems/2620.js) |