Tell us what’s happening:
Output is I'm a little tea Pot
Your code so far
function titleCase(str) {
let nstr=str;
for(let i=0;i<nstr.length;i++){
if(nstr.charAt(i)==" "){
nstr.replace(nstr.charAt(i+1),nstr.charAt(i+1).toUpperCase));}
}
return nstr;
}
console.log(titleCase("I'm a little tea pot"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence/