var r,arr = ['apple', 'strawberry', 'banana', 'pear', 'apple', 'orange', 'orange', 'strawberry','orange'];
r = arr.filter(function (element, index, self) {
return self.indexOf(element) === index;
});
alert(r.toString());
JavaScript 数组去重的完美解决思路
最新推荐文章于 2023-12-11 17:34:47 发布