Javascript Array popMultiple(num)

Description

Javascript Array popMultiple(num)

// Pop multiple elements from an array.
Array.prototype.popMultiple = function(num)
{
 var i = this.length;
 while (i < num)
 {
  if (this.length)
  {//from  www .  j a  va 2  s .c om
   this.pop();
  }
  else
  {
   break;
  }
 }

 return this;
}



PreviousNext

Related