remove the last seperator in nocharacters : javascript code example Example: remove last comma from string javascript str = str.replace(/,\s*$/, "");