function(number, min, max) {
        number = parseFloat(number);

        if (!isNaN(min)) {
            number = Math.max(number, min);
        }
        if (!isNaN(max)) {
            number = Math.min(number, max);
        }
        return number;
    }
function(number, min, max) {
        number = parseFloat(number);

        if (!isNaN(min)) {
            number = Math.max(number, min);
        }
        if (!isNaN(max)) {
            number = Math.min(number, max);
        }
        return number;
    }
function ( number , min , max ) { number = parseFloat ( number ) ; if ( ! isNaN ( min ) ) { number = Math . max ( number , min ) ; } if ( ! isNaN ( max ) ) { number = Math . min ( number , max ) ; } return number ; }
Checks whether or not the passed number is within a desired range.  If the number is already within the
range it is returned, otherwise the min or max value is returned depending on which side of the range is
exceeded. Note that this method returns the constrained value but does not change the current number.
@param {Number} number The number to check
@param {Number} min The minimum number in the range
@param {Number} max The maximum number in the range
@return {Number} The constrained value if outside the range, otherwise the current value
Checks whether or not the passed number is within a desired range . If the number is already within the range it is returned otherwise the min or max value is returned depending on which side of the range is exceeded . Note that this method returns the constrained value but does not change the current number .