Relative newcomer to Javascript and a bit stuck with the following so would greatly appreciate some help...
I have a string made up of a list of categories and keywords which might appear like:
Category A:Keyword A, Category B:, Category C: Keyword B
The problem is displaying a category when there is no keyword - how can I do a Find and Replace to swap instances of :,
with just ,
?
I already use the following to insert a space after the comma:
cats = cats.replace(/,/g,", ");
but copying and modifying with the extra colon seems to break it...