Javascript Array pushIfNotExist(element, comparer)
Array.prototype.pushIfNotExist = function(element, comparer) { if (!this.inArray(comparer)) { this.push(element);/*from w ww . j av a2 s . co m*/ } };