For this one I can see that the uppercasing didn’t work but I want to know why so I can understand where I went wrong. I will map through it as per the solution but I wanna know why this didn’t work with the for loop thank you
function titleCase(str) {
let newStr = str.toLowerCase().split(" ");
for (let i = 0; i < newStr.length; i++) {
newStr[i].replace(newStr[i].charAt(0), newStr[i].charAt(0).toUpperCase())
}
console.log(newStr)
return console.log(newStr.join(" "));
}
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.