I've been asked to turn these two JavaScript functions into a generic function, but I am honestly not sure how to do this:
const increase = (_from, _by, _min) => Math.max(_from * _by, _from + _min);
const decrease = (_from, _by, _min) => Math.min(_from / _by, _from - _min);
I understand that if instead of a value greater than 1, for example .25, the multiplication operator can remain, but I still use Math.max()/Math.min().
So is there a way to make this more generic, without having to add an additional parameter?