Sets test (custom object duplication)
but no luck.
by Ukjin Yang
HTML
<pre id="out"></pre>
JavaScript
function A(val) {
this.value = val
}
A.prototype.valueOf = function() { return String(this.value) }
function B(val) {
this.value = val
}
A.prototype.toString = function() { return String(this.value) }
const a = new A('a'), b = new A('a'), c = new B('b'), d = new B('b')
const set = new Set([a,b,c,d])
set.forEach(item => document.querySelector('#out').appendChild(document.createTextNode(item + '\n')))