javascript strip off last character if it's a semicolon code example Example: remove last comma from string javascript str = str.replace(/,\s*$/, "");