Hi! first of all, thanks for reading .
It’s really a simple question, I made a code for this problem that do the work, but the page doesn’t recognize it as true.
so I want to know your opinions so I can see what’s the trouble.
here’s the code:
‘’'function titleCase(str) {
var result="";
var Copy=str.toLowerCase().split(" ");
var i=0;
while (i<Copy.length){
var Upper= Copy[i][0].toUpperCase();
result += Upper+Copy[i].slice(1)+" ";
if (i==Copy.length){
result += Upper+Copy[i].slice(1);
}
i++;
}
return result.replace(/[!"#$%&/()=]/gi,"");
}
titleCase(“HERE IS MY HANDLE HERE IS MY SPOUT”);