Tell us what’s happening:
I don not know what it is wrong with my code. every thing look fine but went i run it it only checks right that it is a string.help me please.
Your code so far
function titleCase(str) {
var a = str.toLowerCase().split(" ");
var f = " ";
for(var i = 0;i < a.length;i++){
f += a[i].substring(0,1).toUpperCase() + a[i].substring(1,a[i].length) + " ";
}
return f;
}
titleCase("I'm A Little Tea Pot");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/title-case-a-sentence