I am making my debut with coding and i got stuck with a problem. I have to turn the First letter of a string toUpperCase. Can someone please guide me ? e.g : the quick fox ---> The Quick Fox.
here is my code :
function convertFirstLetterOfWordsToUpperCase(phrase){
phrase = phrase.split("");
console.log(mot);
phrase[0] = phrase[0].toUpperCase();
for(var i = 1; i <= phrase.length; i++){
if(phrase[i] == ""){
i++;
phrase[i] = phrase[i].toUpperCase();
}
}
phrase = phrase.join("");
console.log(mot);
}
convertFirstLetterOfWordsToUpperCase("the quick fox");
here is the display : The quick fox.
Thanks for the help.