Tell us what’s happening:
Hello Community! I have been resolving this challenge and I am having a bug! Can you tell me where is my Problem! Thanks in advance!
Your code so far
function titleCase(str) {
//split string to array
let splitString = str.split(" ");
//loop through the array
for(let i = 0; i < splitString.length; i++){
//turn the first letter into upperCase
let upperCase = splitString[i][0].toUpperCase();
//turn all the word into LowerCase
let lowerCase = splitString[i].toLowerCase();
//replace the {lowerCase} first letter to the {upperCase};
let word = lowerCase.replace(splitString[i], upperCase);
//error? why is not returning the {word}
console.log(word);
}
}
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Challenge: Title Case a Sentence
Link to the challenge: