Here you can find the source of isInRangeisInRange(lower, upper)
(function(){/* w w w. j a va 2 s. co m*/ "use strict"; /** * prototype-extension for Number * **/ Number.prototype.isInRange = function isInRange(lower, upper){ /** * Function Number.prototype.isInRange * @name: Number.prototype.isInRange * @version: 0.9 * @author: Korbinian Kapsner * @last modify: 04.08.2009 * @description: ?erpr?b die Zahl in einem bestimmten Bereich liegt * @parameter: * lower: untere Grenze * upper: obere Grenze * */ if (this >= lower && this <= upper){ return true; } if (this <= lower && this >= upper){ return true; } return false; };
Number.prototype.isMultipleof = function (num) { if (this % num === 0) { return true; return false; var result = 0; for (var i = 1; i < 1000; i++) { if (i.isMultipleof(3) || i.isMultipleof(5) ) { ...
Number.prototype.isNegativeZero = function() { var n = this; return n === 0 && (((n = +n) || (1 / n)) < 0);
Number.prototype.isPalindrome = function() { return this == this.reverse(); var max = 0 , x; for (var i = 100; i < 999; i++) { for (var j = i; j < 999; j++) { x = i * j; if (x.isPalindrome() && x > max) { ...
Number.prototype.isPerfPow = function(nroot){ var primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53]; var root,log2,t; t = Math.abs(this); log2 = Math.floor(Math.log(t)/Math.LN2); if(this.isPow2()) return true; root = Math.round(Math.sqrt(t)); if(t - (root * root) == 0){ if(arguments.length > 0){ ...