Javascript Array insertAfter(val, pos)

Description

Javascript Array insertAfter(val, pos)



Array.prototype.insertAfter = function(val, pos) {
  if (pos < self.length - 1)
    return self.splice(pos + 1, val); 
  return self.concat([val]);
}



PreviousNext

Related