dwyl / dwyl/learn-javascript

Title Case a Sentence

Open
#25 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
HTML
Stars
65
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hello,

So I'm beginning to understand things a little bit more! :sparkles:

This one is beginning to annoy me though. It's just returning "I'm a little tea pot" which is about as annoying as when you order a pot of tea and it has just one cup's worth in it. :tea:

Thanks in advance!

**QUESTION**

Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.

For the purpose of this exercise, you should also capitalize connecting words like "the" and "of".

Remember to use Read-Search-Ask if you get stuck. Write your own code.

**MY CODE**

```

function toUpperCase(str) {

str = str.toLowerCase().split(" ");

for (var i = 0; i < str.length; i++) {
str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);

return str.join (" ");
}
}

titleCase("I'm a little tea pot");
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.