I'm currently trying to figure out how to capitalize the first letter of each word in a string (all other letters in the word lowercase). For example: "Coding Can Be Confusing"
Here's what I have so far. I know I am definitely missing code, I'm just not sure what should come next. I'm also not sure if what do I have is even correct. Any help would be greatly appreciated.
function titleCase(str) {
var words = str.toLowerCase.split(' ');
for(i = 0; i < words.length; i++) {
var firstLetter = words[i].charAt(0).toUpperCase;
}
return words.join(' ');
}
titleCase("I'm a little tea pot");