Tell us what’s happening:
Why this code is not working? It is giving proper output but not accepting by freecodecamp.
Your code so far
function titleCase(str) {
let str1=str.toLowerCase().split(' ');
let tu =''
for(let i=0;i<str1.length;i++){
tu += ' '+str1[i].replace(str1[i].charAt(0),str1[i].charAt(0).toUpperCase());
}
return tu;
}
console.log(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/83.0.4103.97 Safari/537.36.