SOURCE

const arr= [1,"a",{b:2},{b:2},{c:3},{c:"3"},"1","a"]
var deepEqual = function (x, y) {
if (x === y) {
return true;
}
else if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) {
if (Object.keys(x).length != Object.keys(y).length)
return false;
for (var prop in x) {
if (y.hasOwnProperty(prop))
{
if (! deepEqual(x[prop], y[prop]))
return false;
}
else
return false;
}
return true;
}
else
return false;
}
function filter(arr){
const bakEl = []
return arr.filter(el=>{
const isNeed = bakEl.every(bakEl=>!deepEqual(bakEl,el));
if(isNeed){
bakEl.push(el)
}
return isNeed;
})
}
const c=filter(arr)
console.log(c);
console 命令行工具 X clear

                    
>
console