Basic Algorithm Scripting - Title Case a Sentence

Tell us what’s happening:

I’m stuck. Here’s the pseudo code:
for (var i = 0, i < str.length, i++) {
str.split();
word[0].toUpperCase;
word[1,…].toLowerCase;
}

Your code so far

function titleCase(str) {
  for (let i = 0; i < str.length; i++) {
    str.split();
  }
  return str;
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Basic Algorithm Scripting - Title Case a Sentence

First convert the all the characters into lower case with “toLowerCase” function.
Then refer to the following article from freecodecamp for the rest of the steps.

Hi @KoduFCC

There are two parts to this exercise.

Part 1 is to capitalise the first letter of each word.
Part 2 is to lowercase the remaining letters of each word.

To help you along, place the function call in a console.log() so you can see what the function is returning.

Happy coding

I know, but I used the split method. I wanted to confirm if that method is correct or if I need to use a different method, and which one I need to use.

With programming, there may ways to solve a problem.

For this one you could use a loop or another method.
Write down in words what you need to do for each part or section, then test out with your code.

Happy coding