function titleCase(str) {
let words = str.toLowerCase().split(" ");
for (let i = 0 ; i < words.length ; i++) {
words[i][0].toUpperCase();
}
return words;
}
titleCase("I'm a little tea pot");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36.
The toUpperCase does not mutate the string “in place” that it is called on. Instead it returns a new value. You would need to assign this result to a variable to be able to capture the created string. Remember, strings are immutable, so you can not directly change characters in them. You can however create new strings from existing strings’ characters. This can be done via referencing the existing string’s characters or using string methods to capture the characters.