方法一
new Set(dataArray)
方法二
Array.prototype.dataArray = () => {
return this.filter((item, index) => {
return this.indexOf(item === index);
});
};
方法三
Array.prototype.dataArray = () => {
const arr = [];
this.forEach(item => {
if (arr.indexOf(item) === -1) {
arr.push(item);
}
});
return arr;
};