Substitua vários espaços por JavaScript de espaço único
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."