Hello, it’s me again
i have a little problem to get unique items out of an array/object.
This is what i have…
…here the important code-snipet…
for (var i = 0; i < res.items.length; i++) {
let item = res.items[i]
console.log("myFilter",myFilter)
myFilter.push({"ID": res.items[i]._id, "VALUE":res.items[i]})
console.log("myFilter-ID",myFilter)
// let uniq = [...new Set(myFilter()]
// console.log("Unique",uniq)
}
I have an array/object with dublicates in it. All attempts to use —>
let uniq = [...new Set(myFilter()]
…i got wrong results, or errors.
The end-result what i need, are the unique items by founded unique IDs…
0) —> b72bad46-f39b-4204-902b-76daad3e60cb
- —> a5fc5581-4973-4afd-b29e-fe9d11473738
- —> 4c6c15f0-69c6-4c71-a4cd-a0cf01cfbf8f
…like this … (the end-result should look like this, but without dublicates)…
CODE:
let item = res.items[i]
myFilter.push(item)
console.log(,myFilter)
Result:
I need just the UNIQUE items from this ARRAY.
What am i missing?