diff --git a/js/prototype.js b/js/prototype.js index dd69ae0ebe01bc566af3597fd904200f26470e47..d14c281ce8965d2ffb8048caaa9cfe0b6c5e8de9 100644 --- a/js/prototype.js +++ b/js/prototype.js @@ -1,3 +1,9 @@ -String.prototype.capitalize = function() { - return this.charAt(0).toUpperCase() + this.substr(1); +/** + * Checks if the number is between two given values. + * @param {number} min The minimum value. + * @param {number} max The maximum value. + * @param {boolean} inclusive Whether or not to include the minimum and maximum values. + */ +Number.prototype.between = function(min, max, inclusive = false) { + return inclusive ? this >= min && this <= max : this > min && this < max; };