Javascript Array tail()

Description

Javascript Array tail()

Array.prototype.tail = function () {
    if (this.length == 0) {
        return null;
    }/*from   w w  w  .  ja  v  a  2 s  .co  m*/
    var tail = new Array();
    var length = this.length;
    for (var i = 1; i < length; i++) {
        tail.push(this[i]);
    }
    return tail;
}



PreviousNext

Related