Skip to content

Commit 140b91a

Browse files
committed
update solve problem to Allow One Function Call
1 parent c339fc0 commit 140b91a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Diff for: 2666. allow-one-function-call/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const once = (fn) =>{
2+
let called = false
3+
return (...args) => {
4+
if(called) return
5+
called = true
6+
return fn(...args)
7+
}
8+
}

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
| Array Reduce Transformation ||
1414
| Function Composition ||
1515
| Return Length of Arguments Passed ||
16-
| Allow One Function Call | |
16+
| Allow One Function Call | |
1717
| Memoize | |
1818
| Add Two Promises | |
19-
| Sleep | |
19+
| Sleep | |
2020
| Timeout Cancellation | |
2121
| Interval Cancellation | |
2222
| Promise Time Limit | |

0 commit comments

Comments
 (0)