What is the best way to approach this?
I have an array:
tiers = [
{800, 1000},
{600, 799},
{400, 599},
{0, 399}
]
These represent the min and max value for each tier.
The user can then change any of the min/max values except 1000 and 0 respectively.
-
The values for each tier should respect the corresponding values.
For example, if I change 799 to 798, then in the above tier 800 will change to 799. -
The values cannot overlap. Example: if 799 (max) is reduced to 600(min), it should stop at 601, then the above tier should be 602. It would be nice if each corresponding tier changed, but it is not necessary a simple return false would work.
I have tried a few different things, but I am unable to encompass all the variations. Seems like a simple little puzzle, but I can’t figure it out.