class Greeter {
greeting: string;
constructor(message: string) {
this.greeting = message;
}
greet() {
return "Hello, " + this.greeting;
}
}
const a = new Greeter('1');
const b = new Greeter('2');
const c = new Greeter('3');
const myArr = [a, a, a, a, b, c, c, c, b, c, c, b, b, b, b, c, c, a, a, a, a];
const mySet = new Set(myArr);
const finalArr = Array.from(mySet);
console.log(finalArr)
你所谓的循环引用的对象,具体是个什么样子?
常规的数组去重,我就array转set,在转回array。写起来简单,性能好不好不太清楚