**My code is working on the terminal but when i run the tests, it fails. Can someone help **
My code below*
function titleCase(str) {
let str_Splits = str.split(" ");
let results = ""
for (let i = 0; i < str_Splits.length; i++){
results+= str_Splits[i][0].toUpperCase() + str_Splits[i].slice(1).toLowerCase() + " "
}
return results
}
console.log(titleCase("I'm a little tea pot"));
function titleCase(str) {
let str_Splits = str.split(" ");
let results = ""
for (let i = 0; i < str_Splits.length; i++){
results+= str_Splits[i][0].toUpperCase() + str_Splits[i].slice(1).toLowerCase() + " "
}
return results.trim()
}
console.log(titleCase("I'm a little tea pot"));