Замените несколько мест на одно пространство JavaScript
string = string.replace(/\s\s+/g, ' ');
Distinct Deer
string = string.replace(/\s\s+/g, ' ');
var multiSpacesString="I have some big spaces.";
var singleSpacesString=multiSpacesString.replace(/ +/g, ' ');//"I have some big spaces."
string = string.replace(/\s\s+/g, ' ');