This function ensures that the value a is between the min and max values.
If a is less than min, it returns min; if a is greater than max, it returns max.
Otherwise, it returns a itself.
Parameters
a: number
The value to clamp.
Optionalmin: number
The lower bound of the clamp range. Defaults to 0.
Optionalmax: number
The upper bound of the clamp range. Defaults to 1.
Clamps a value within a specified range.
This function ensures that the value
ais between theminandmaxvalues. Ifais less thanmin, it returnsmin; ifais greater thanmax, it returnsmax. Otherwise, it returnsaitself.