Hey everyone,
I’m not really sure why I can’t pass the Title Case a Sentence algorithm with the following code, it passes all of the tests in the console. Any thoughts?
var titleCase = function titleCase(str) {
var splitSentence = str.toLowerCase().split(' ');
var titleCasedArray = splitSentence.map(function (el) {
return el.charAt(0).toUpperCase() + el.substring(1, el.length);
});
var result = titleCasedArray.join(' ');
return result;
};
titleCase("I'm a little tea pot");