Skip to content

Commit b921fe4

Browse files
committed
counter-ii description
1 parent b0e1e9e commit b921fe4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

easy/counter-2.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
/**
2+
* Creates a counter object with methods to increment, decrement, and reset the counter.
3+
*
4+
* @param {number} init - The initial value of the counter.
5+
* @returns {object} - An object with three methods:
6+
* - `increment()`: Increases the counter by 1 and returns the new value.
7+
* - `reset()`: Resets the counter to the initial value and returns the new value.
8+
* - `decrement()`: Decreases the counter by 1 and returns the new value.
9+
*/
10+
111
const createCounter = (init) => {
212
let counter = init;
313
return {

0 commit comments

Comments
 (0)