We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 709a21a commit 5c47a2eCopy full SHA for 5c47a2e
JavaScript/6-wrap-once.js
@@ -6,8 +6,9 @@ const once = (fn) => {
6
let finished = false;
7
return (...args) => {
8
if (finished) return;
9
+ const res = fn(...args);
10
finished = true;
- fn(...args);
11
+ return res;
12
};
13
14
JavaScript/7-wrap-count.js
@@ -5,8 +5,10 @@
5
const limit = (count, fn) => {
let counter = 0;
- if (counter++ === count) return;
+ if (counter === count) return;
+ counter++;
0 commit comments