get rid of spaces in a string js regex code example Example: remove all spaces from a string javascript .replace(/ /g,'')