Javascript Number between(n1, n2)

Description

Javascript Number between(n1, n2)

Number.prototype.between = function(n1, n2){
  var min = (n1 < n2) ? n1 : n2,
      max = (n1 < n2) ? n2 : n1;//ww  w .  j  a v a2s  .c om
      
  return this >= min && this <= max;
}



PreviousNext

Related