Situs: stackoverflow.com JavaScript Ganti beberapa spasi dengan ruang tunggal

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