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