I need to check a JavaScript array to see if there are any duplicate values. What’s the easiest way to do this? I just need to find what the duplicated values are – I don’t actually need their indexes or how many times they are duplicated.
I know I can loop through the array and check all the other values for a match, but it seems like there should be an easier way.
Similar question:
- Get all unique values in a JavaScript array (remove duplicates)