WillSquire
6/23/2015 - 2:21 PM

In Range - See if the value is in the range of a and b.

In Range - See if the value is in the range of a and b.

/**
 * Checks if a value is in the range (inbetween) the
 * value of a and b. Will also return true if equal to
 * either value.
 *
 * @param {number} value
 * @param {number} a
 * @param {number} b
 * @returns {boolean}
 */
function inRange(value, a, b) {
  if (a < b)
      return (value >= a && value <= b);
  return (value >= b && value <= a);
}