Why this no past?

Tell us what’s happening:
My console.logs look correct. Why does this code not pass the tests?

   **Your code so far**
titleCase(str) {
 let ss= str.split(" ");
  let ns = '';

  for(let i =0; i< ss.length; i++){
    for (let j = 0; j < ss[i].length; j++){
      if (j == 0){
        ns += " ";
        ns += ss[i][j].toUpperCase();
      }
      else{
        ns += ss[i][j].toLowerCase(); 
      }
    }
  }

  console.log(ns)
  return ns; 
  }

titleCase("I'm a little tea pot");
   **Your browser information:**

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

Challenge: Title Case a Sentence

Link to the challenge:

I’m reading my post back and I think I figured it out. I think I am getting an uneccesary space at the beginning of the string.

That was it. Disregard

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