Javascript Number inRange( a, b )

Description

Javascript Number inRange( a, b )


Number.prototype.inRange = function( a, b ) {
 var value = this.valueOf();
 return ( value >= a ) && ( value <= b );
};

Javascript Number inRange(a, b)


// --------------------------------------------------------
//  `Number` polyfills
// --------------------------------------------------------

// Check, if number is in range of `a` and `b`
Number.prototype.inRange = function (a, b) {
 var value = this.valueOf();
 return (value >= a) && (value <= b);
};

Javascript Number inRange(a,b)


Number.prototype.inRange = function(a,b){
 if((this) >= a && (this) < b){
 return true /* w w  w . java2 s.c  o  m*/
 }else{
 return false 
 }
};



PreviousNext

Related