Javascript Array pushUnique()

Description

Javascript Array pushUnique()

Array.prototype.pushUnique = function() {
 for (var i = 0; i < arguments.length; ++i) {
  if (this.indexOf(arguments[i]) < 0) {
   this.push(arguments[i]);//from   w w  w .  j  a v  a  2  s  . c  o  m
  }
 }

 return this;
};



PreviousNext

Related