Can't understand how to loop through all arrays and push it into one avoiding duplicates, so I can have the result like:
['All', 'Images', 'Video']
So far, now I have the following, but it is not that expected:
let filterize = function(el, config){
let target = document.getElementById(el);
let arrayCommon;
for(let value in config) {
arrayCommon = [...new Set([...config[value].filter])];
}
console.log(arrayCommon)
}
var filterize_init = new filterize('Filtered', {
element_1: {
filter: ['All', 'Image']
},
element_2: {
filter: ['All', 'Video']
}
})
<div class="wrapper">
<div id="Filtered" class="filter-content">
</div>
</div>
Can anyone help ?