javascript replace two spaces with one
snippet in javascript

replace multiple spaces with single space javascript

user8028

string = string.replace(/\s\s+/g, ' ');

javascript replace two spaces with one

user7372

var multiSpacesString="I  have     some big    spaces.";
var singleSpacesString=multiSpacesString.replace(/  +/g, ' ');//"I have some big spaces."