Remove spaces from a given string | Function to remove all spaces from a given string ; Driver Code
function removeSpace ( str ) { str = str . replace ( / \s / g , ' ' ) return str ; } var str = " " ; document . write ( removeSpace ( str ) ) ;