Tell us what’s happening:
I’m stuck on this exercise. My code doesn’t work. I get a Type Error, and the statement that the contents of my for loop isn’t a function.
Can someone tell me what’s wrong here?
Your code so far
function titleCase(str) {
var textSplit = str.split();
var textArray = [];
for (var i = 0; i < textSplit.length; i++) {
textArray[i] = textSplit[i].toLowerCase().replaceAt(0, textSplit[i].charAt(0).toUpperCase());
}
return textArray.join(' ');
}
titleCase("I'm a little tea pot");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
.
Link to the challenge: