Tedious way to capitalize first letter

Tell us what’s happening:

After I’ve done some research and struggled my way through this challenge I feel like there has to be a more efficient way to solve this. My questions is if this code ‘good enough’ or is there something I could do that would be more reasonable?

Any help or suggestions on how to improve my code would be greatly appreciated.

Your code so far

function titleCase(str) {
let newStr = str.toLowerCase().split(" ");

for(let i = 0; i < newStr.length; i++){
  newStr[i] = newStr[i].replace(newStr[i].charAt(0), newStr[i].charAt(0).toUpperCase());
return newStr.join(" ").replace(",", " ");

titleCase("I'm a little tea pot");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36.

Challenge: Title Case a Sentence

Link to the challenge:

Until you learn regular expressions, that pretty much how you would do it.

  str = "string"
	tmp = str.substring(0,1);
	tmp1 += tmp.toUpperCase() + str.substring(1)+" ";
            alert(tmp1)//alerts String

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

My Bad
A working solution was already posted.
I replied to that post and gave an alternative.
It won’t happen again!

you blurred out my post but you
didn’t blur out the working solution
in the first post of this thread