Node.js examples for Array:Remove Element
Remove duplicate value from array
Array.prototype.removeDups = function(){ var result = []; for(var i = 0; i < this.length; i++){ if(result.indexOf(this[i]) < 0){ result.push(this[i]);//from w ww . j a v a 2s. co m } } return result; } console.log([1, 1, 2, 3, 2].removeDups());