Hello. Why doesn't work my code?

Tell us what’s happening:
Describe your issue in detail here.

it has a coorect output. But somehow it does not pass

  **Your code so far**

function titleCase(str) {
let arr = []
str.split(' ').forEach(el=>{
  
  arr.push(el.charAt(0).toUpperCase()+el.slice(1))
})

return arr.join(' ')

}

console.log(titleCase("I'm a little tea pot"))
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36

Challenge: Title Case a Sentence

Link to the challenge:

On the left, below the description, you got the test-cases for your code with the expected output.
If you try those which you fail, you’ll notice that you are not producing the correct output for some of them :wink:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.