var name = "Code padding"; //remove multiple space to single name = name.replace(/ +/g, ' '); // Code padding