Here you can find the source of max(maximum)
// Limit a number to a max value Number.prototype.max = function(maximum) { if (this.valueOf() > maximum){ return maximum; } else {/*from w w w . j a v a 2 s. c o m*/ return this.valueOf(); } };
Number.prototype.gt = function(right) { return this > right }; Number.prototype.ge = function(right) { return this >= right }; Number.prototype.lt = function(right) { return this < right }; Number.prototype.le = function(right) { return this <= right }; Number.prototype.eq = function(right) { return this == right }; Number.prototype.ne = function(right) { return this != right };
Number.prototype.hasDiv = function( n ) { return Number.isInteger( this / n ) function sum( ary ) { var out = 0 for (var n in ary) { out += ary[n] return out ...
Number.prototype.hasMult = function( n ) { return Number.isInteger( this / n ) function fun100() { out = [] for ( var i = 1; i <= 100; i++ ) { if ( i.hasMult(3) ) { out.push['Fizz'] else if ( i.hasMult(5) ) { out.push['Buzz'] else if ( i.hasMult(5) && i.hasMolt(3) ) { out.push["Fizzbuzz"] else { out.push( i.toString() ) return out
var num = 5; Number.prototype.int = function(){ return parseInt(this) ; Number.prototype.float = function(){ return this.toFixed(2); console.log(num.float()); console.log(num); ...
Number.prototype.intToHSL = function() { var shortened = this % 360; return "hsl(" + shortened + ",45%,56%)"; };
Number.prototype.min = function(minimum) { if (this.valueOf() < minimum){ return minimum; } else { return this.valueOf(); };
Number.prototype.mod = Number.prototype.mod || function(n) { return ((this%n)+n)%n;
Number.prototype.mult = function() { var w = this; for (var i = 0; i < arguments.length; i += 1) w *= arguments[i]; return w; var n = 12; console.log(n.mult(2, 3)); console.log((5).mult(2, n)); ...
Number.prototype.next = function(){ return this+1; };