Nodejs Number Between between(n1, n2)

Here you can find the source of between(n1, n2)

Method Source Code

Number.prototype.between = function(n1, n2){
  var min = (n1 < n2) ? n1 : n2,
      max = (n1 < n2) ? n2 : n1;/*from w w  w .j a v  a2  s .com*/
      
  return this >= min && this <= max;
}

Related

  1. between(a, b)
    Number.prototype.between = function(a, b) {
      var min = Math.min.apply(Math, [a, b]),
        max = Math.max.apply(Math, [a, b]);
      return this > min && this < max;
    };
    
  2. between(a, b)
    Number.prototype.between = function(a, b){
      return (this >= a && this < b);
    function getDirection(ox, oy, tx, ty){
      var dx = tx - ox;
      var dy = ty - oy;
      var rad = Math.atan2(dx, dy);
      var degree = (rad*180)/Math.PI;
      if( degree < 0 ) degree += 360;
    ...
    
  3. between(a, b, inclusive)
    Number.prototype.between = function (a, b, inclusive) {
        var min = Math.min.apply(Math, [a, b]),
            max = Math.max.apply(Math, [a, b]);
        return inclusive ? this >= min && this <= max : this > min && this < max;
    };
    
  4. between(a, b, inclusive)
    http:
    Number.prototype.between = function (a, b, inclusive) {
        var min = Math.min.apply(Math, [a,b]),
            max = Math.max.apply(Math, [a,b]);
        return inclusive ? this >= min && this <= max : this > min && this < max;
    };
    
  5. between(a, b, inclusive)
    Number.prototype.between = function (a, b, inclusive) {
        var min = Math.min.apply(Math, [a,b]),
            max = Math.max.apply(Math, [a,b]);
        return inclusive ? this >= min && this <= max : this > min && this < max;
    };
    
  6. between(x,y)
    Number.prototype.between = function(x,y) {
        return (this.valueOf() >= x && this.valueOf() <= y)