javascript remove last value of comma separated string code example Example: remove last comma from string javascript str = str.replace(/,\s*$/, "");