Tell us what’s happening:
Your code so far
function titleCase(str) {
let tr = str.trim().toLowerCase().split(' ');
tr.forEach(items => items.slice(0,1).toUpperCase() + items.slice(1))
}
console.log(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/74.0.3729.169 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence