We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 183af1c commit cb943a7Copy full SHA for cb943a7
assignments/closure.js
@@ -41,6 +41,9 @@ console.log(newCounter()); // 2
41
// ==== Challenge 3: Create a counter function with an object that can increment and decrement ====
42
const counterFactory = () => {
43
// Return an object that has two methods called `increment` and `decrement`.
44
+ let count = 0;
45
// `increment` should increment a counter variable in closure scope and return it.
46
+ const increment = function() {count++; return count};
47
// `decrement` should decrement the counter variable and return it.
-};
48
+ const decrement = function() {count; return count};
49
+};
0 commit comments