Javascript Array sortInc()

Description

Javascript Array sortInc()


// Array/*from ww w . j a  v a  2 s . c om*/

Array.prototype.sortInc = function() {
    this.sort(function(a, b) {
        if (a > b) {
            return 1;
        } else if (a < b) {
            return -1;
        } else {
            return 0;
        }
    });
}



PreviousNext

Related