|
|
|
|
|
by jacobolus
2129 days ago
|
|
It’s usually nicer to make a helper function: const clamp = (x, low, high) =>
Math.max(low, Math.min(x, high));
Then it can be easily used later via a descriptive name. e.g. color_component = clamp(color_component, 0, 255);
|
|