Remove duplicates in array

I have two arrays, one for categories, and one for brands. I want to filter out every occurance of the the same brand, or category. It works but does have some bugs. It seems that either if there is more than 2 occurances it does not remove it and I get two of the same brand in my list. Or it's just if it's duplicate on the very first and last round of the for loop. that my conditions does not check out. It should not be a difference in data value. but hard to tell with data from 20+ stores
2 Replies
NorthBit (Joakim)
Notice the console it says deleted and then what it deleted, does so twice. but third round it console.log("deleted", undefined) So it understood it was time to delete. but did not catch a value do delete. categories[j] at that point was undefined
13eck
13eck2y ago
Can you please replace that screen shot of your code with actual code? See #How To Ask Good Questions for how to create codeblocks.