//Altered, "capitalize all words of a string" (javascript by Grepper on Jul 22 2019) answer to compatible with TypeScript
var myString = 'abcd abcd';
capitalizeWords(text){
return text.replace(/(?:^|s)S/g,(res)=>{ return res.toUpperCase();})
};
console.log(capitalizeWords(myString));
//result = "Abcd Abcd"