Skip to content

Commit 0bbd17e

Browse files
author
KickMe
committed
commented out our work in progress in closure.js
1 parent 5c8c049 commit 0bbd17e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/closure.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const counterFactory = () => {
1818
// `increment` should increment a counter variable in closure scope and return it.
1919
// `decrement` should decrement the counter variable and return it.
2020
/*
21+
22+
// Work in progress
2123
let counter = 0;
2224
2325
const increment () {
@@ -28,7 +30,15 @@ const counterFactory = () => {
2830
};
2931
myObj = {increment, decrement};
3032
return myObj;
31-
*/
33+
34+
// New approach
35+
let count = 0;
36+
37+
const myObj = {
38+
increments: count++,
39+
decrement: count--,
40+
};
41+
*/
3242
};
3343

3444
const limitFunctionCallCount = (cb, n) => {

0 commit comments

Comments
 (0)