Tell us what’s happening:
Describe your issue in detail here.
It is running fine and giving the same output in online compiler and here I am not able to pass test cases. Your code so far
function titleCase(str) {
let my=str.split(" ");
let myStr="";
let result="";
for(var i=0;i<my.length;i++)
{
myStr=my[i].toLowerCase();
myStr=my[i].charAt(0).toUpperCase()+myStr.slice(1,myStr.length)+" ";
result+=myStr;
}
// console.log(result);
return result;
}
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/91.0.4472.114 Safari/537.36