var arr = [1, 23, 1, 1, 1, 3, 23, 5, 6, 7, 9, 9, 8, 5];
Array.prototype.forEach = Array.prototype.forEach || function(callback, thisArg) {
if (!callback || typeof callback !== 'function') return;
for (var i = 0, j = this.length; i < j; i++) {
callback.call(thisArg, this[i], i, this);
}
} /*
forEach方法实现数组去重
*/ var newArr = [];
arr.forEach(function(ele,index,arr){
if(arr.indexOf(ele)===index){
newArr.push(ele);
}
})
console.log(newArr);