The console shows the letters being the way the exercise wants, but it’s incorrect.
let x = str.split(' ')
let y
for(let i = 0; i < x.length; i++) {
y = x[i][0].toUpperCase() + x[i].substring(1).toLowerCase()
console.log(y)
};
return y
}
You aren’t logging what you think you are logging:
function titleCase(str) {
const splitStr = str.split(' ');
let outputStr;
for (let i = 0; i < splitStr.length; i++) {
outputStr = splitStr[i][0].toUpperCase() + splitStr[i].substring(1).toLowerCase();
}
return outputStr
}
console.log(titleCase("I'm a little tea pot"));
So, the only way, as of now, that I’ve been able to create those spaces is by there being a space between a backtick and a curly bracket but still not good…