Javascript Math limitToRange(lo, hi, number) {
Math.limitToRange = function(lo, hi, number) { return Math.min(hi, Math.max(lo, number)); }