Got some code to capitalize the first letter of every word in a string. Can someone please help me update it so it also removes all spaces within the string once the first letters are Capped.
return function (str) {
return str.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1);
});
}