Javascript Number trim(a, b)

Description

Javascript Number trim(a, b)


Number.prototype.trim = function(a, b) {
  var min = Math.min(a, b),
      max = Math.max(a, b);/*from w  w w  . j av a  2s  .  c  o  m*/

  return Math.min(Math.max(parseInt(this, 10), min), max);
};



PreviousNext

Related