This question already has an answer here:
- Get all unique values in a JavaScript array (remove duplicates) 63 answers
I have string values that contain a list of items separated with a comma, e.g. the value could be val1,val2,val3,val1,val4,val3,val2,val5.
Is there an easy way I can remove all duplicates from such a string so that each value only appears once within the string ?
E.g. in the above example I would like to get val1,val2,val3,val4,val5 instead.
Many thanks in advance, Tim.