Please help with - Basic Algorithm Scripting: Title Case a Sentence

Tell us what’s happening:
Hello, thanks for looking. I feel like I have solved the problem but whenever I run it I fail on every category. I have console logged each step and they all seem to work and give me the right answer but I cant seem to pass.

I know this is a complicated way of doing it but I normally try to go fully from memory and then re-solve it in a more streamlined way once completed. I am just stumped on this one.


Your code so far

function titleCase(str) {
    var lowerCaseString = str.toLowerCase();
    var splitString = lowerCaseString.split(" ");
    for (var i=0; i <splitString.length ;i++) {
        splitString[i] = splitString[i].charAt(0).toUpperCase() + splitString[i].substring(1);
    var combineString = splitString.join (" ");

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0.

Link to the challenge:

Your function doesn’t return anything.

1 Like

The link to the question you are on is for a different challenge :confused:


added this and it works.

return combineString;

Thanks, it auto filled that so I edited it.