I am doing the Title Case a String challenge, and my final code is outputting (I can’t get the backslash to show, but it’s in the word “I’m) ‘I’m a little tea pot’, which won’t pass the test due to the slash. I’ve tried googling how to remove it. I’m getting things like adding “.replace(”\/g”, “”)", but for one, I dont really understand the syntax, and also it’s not working. Any help is appreciated.
function titleCase(str) {
let words = str.split(" ");
for (var i=0; i<words.length; i++){
words[i][0].toUpperCase();
};
let finished = words.join(" ");
return finished;
}
titleCase("I'm a little tea pot");