Javascript Number limit(min, max)

Description

Javascript Number limit(min, max)


Number.prototype.limit = function(min, max) {
    var i = this;
    if (i < min) i = min;
    if (i > max) i = max;
    return i;//from w w w . j ava2s  .  co m
};



PreviousNext

Related