Not showing "Submit and Go to Next Challenge"

Tell us what’s happening:
Hello Everyone, I’m a freeCodeCamp learner.
I want to ask that I have written code that return the provided string with the first letter of each word capitalized. According to the task, I have written correct code and output is also correct but it is not showing “Submit and Go to Next Challenge”.

Only showing this:
// running tests
titleCase(“I’m a little tea pot”) should return I’m A Little Tea Pot.
titleCase(“sHoRt AnD sToUt”) should return Short And Stout.
titleCase(“HERE IS MY HANDLE HERE IS MY SPOUT”) should return Here Is My Handle Here Is My Spout.
// tests completed
strong text
Your code so far


function titleCase(str) {
var words = str.toLowerCase().split(" ");
var i,j, narr = "";
for( i = 0; i<words.length; i++){
    for( j = 0; j<1;j++ ){
        var s = words[i];
        s = s.replace(s.charAt(0), s.charAt(0).toUpperCase());
        narr = narr + s + " ";
  }
}
console.log(narr);
return narr;
}

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/83.0.4103.61 Safari/537.36.

Challenge: Title Case a Sentence

Link to the challenge:

there’s extra space in your output (the last character of the string)
"I'm A Little Tea Pot "

2 Likes

if the tests appear in the output, they fail and there is something not quite right, when you have strings like this you can try to use: console.log(JSON.stringify(narr));
in this way you can see also the spaces at the end

2 Likes

Thanks
I didn’t notice that last space.