javascript add space after comma code example
Example 1: js remove space before string
var str = " Some text ";
str.trim();
// str = "Some text"
Example 2: javacript string add space after commas
"1,2, 3,4,5".replace(/,(?=[^\s])/g, ", ");
> "1, 2, 3, 4, 5"