方法一:
Array.prototype.uniq = function () {
let arr = [];
this.forEach((item, index, array) => {
const result = arr.some((x) => Object.is(x, item));
if (result === false) {
arr.push(item);
}
});
return arr;
}
方法二:(来自他人...T T
Array.prototype.uniq = function () {
return Array.from(new Set(this))
}