Javascript Array last(num)

Description

Javascript Array last(num)



Array.prototype.last = function (num) {
   if (num !== undefined) {
      return this.slice(-num);
   }/*  ww  w. ja  v a  2s  .  c o m*/
   return this[this.length - 1];
};



PreviousNext

Related