chapter 6: functions

task 1

Set and decrease for counter

Modfy the code of makeCounter() so that the counter can also decrease and set the number:

  • counter() should return the next number(as before).
  • counter.set(value) should set the counter to value.
  • counter.decrease() should decrease the counter by 1.

P.S. You can use either a closur or the function property to keep the current count. Or write both variants.