JavaScript - Title Case a Sentence

I had a 2nd challenge that works on my local machine( Node.js v10.17.0 Ubuntu 18.04.3 LTS), but not in freeCodeCamp. Any help is greatly appreciated.

Here is my code:

function titleCase(str) {
    var lowerCaseStr = str.toLowerCase();
    word_list = lowerCaseStr.split(" ")
    for (var i = 0; i < word_list.length; i++) {
        word_list[i] = word_list[i].charAt(0).toUpperCase() + word_list[i].substring(1);
    return word_list.join(' ');
console.log(titleCase("I'm a little tea pot"));
console.log(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT"));
console.log(titleCase("sHoRt AnD sToUt"));

Make sure to declare all variables.

You didn’t declare word_list. When working on your local machine, try using strict mode.

Thank you for the quick response on both of my post. I will be sure to slow down now…and do a better job.

Thank you for the quick response…I had 2 post with the same issue, so that resolved it. I learned Python first , so I need to be sure to be mindful of the syntax (and best practices). Have a good evening.