Tip:
npm run test5
-
Create a Counter factory with:
- A private _value property initiated with 0.
- A public getValue method.
Initialize and assign it to a variable and make a call to getValue from outside printing the counter value;
-
Add to Counter:
- A private _changeValueBy method to change it's value.
- A public increment method that calls _changeValueBy;
- A public decrement method that calls _changeValueBy;
Initialize two counters and make subsequent calls to increment and decrement then compare values of each counter instance;