Javascript Array pushIfNotExists(value)

Description

Javascript Array pushIfNotExists(value)

Array.prototype.pushIfNotExists = function (value) {
    if (this.indexOf(value) == -1) {
        this.push(value);/*w  ww . j av  a  2  s  . c o  m*/
    }
}



PreviousNext

Related