Tell us what’s happening:
Describe your issue in detail here.
Although My Output Is Completely True, It Says That I’m Wrong
**Your code so far**
function titleCase(str) {
str=str.split(" ")
let oneLine=""
let eachWord=[]
for(let i=0; i<str.length; i++){
eachWord.push(str[i])
}
for(let j=0; j<eachWord.length; j++){
oneLine+=eachWord[j][0].toUpperCase()+((eachWord[j].replace(eachWord[j][0],"")).toLowerCase())+" "
//oneLine+=(array[j][0].toUpperCase())+(array[j].toLowerCase()).replace(array[j][0],"")+" "
}
return oneLine;
}
console.log(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT"));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Title Case a Sentence
Link to the challenge: