function constrain(n, low, high) {
  if (n < low) return low;
  if (n > high) return high;

  return n;
}
Constrain `n` between `high` and `low`

@param {number} n
@param {number} low
@param {number} high