Basic Algorithm Scripting - Title Case a Sentence

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function titleCase(str) {
  let Diff_words = str.split(" ");
  let Processed_Char = "";
  let Diff_Char = [];
  for (let i = 0; i < Diff_words.length; i++)
  {
    Diff_Char = Diff_words[i].split("");
    Processed_Char += Diff_Char[0].toUpperCase();

    for (let j = 1; j < Diff_Char.length; j++)
    {
      Processed_Char += Diff_Char[j].toLowerCase();
    } 
    Processed_Char += " ";
  }
  return Processed_Char;
}

console.log(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/112.0.0.0 Safari/537.36

Challenge: Basic Algorithm Scripting - Title Case a Sentence

Link to the challenge:

Can you describe what you are struggling with in this challenge please? The more you say, the more we can help!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.