Is there a way to go through the properties of an object and eliminate duplicates from an array stored as the value for each property?
Initial object
var navObjects = {
'Components': ['x', 'y', 'x'],
'Document': ['z', 'z', 'z', 'q'],
'Utilities': ['a', 'b', 'c']
}
Target object
navObjects: {
'Components': ['x', 'y'],
'Document': ['z','q'],
'Utilities': ['a', 'b', 'c']
}
Approach attempted
for (let i = 0; i < Object.values(navObjects).length; i++) {
let obj = Object.values(navObjects)[i];
Object.values(obj).filter((item, index) => obj.indexOf(item) === index);
console.log(obj);
}
Despite executing this code block, the arrays are not altered.