how to remove all white spaces in a string in javascript code example Example: remove all spaces from a string javascript .replace(/ /g,'')