Javascript Array uniqe()

Description

Javascript Array uniqe()


'use srcipt';/* ww w  .  j  ava2  s.com*/

Array.prototype.uniqe = function () {

    var result = [];

    this.forEach(function (v){
        if (result.indexOf(v) < 0) {
            result.push(v);
        }
    });

    return result;

}



PreviousNext

Related