dwyl / dwyl/learn-javascript

Title Case a Sentence

Aperta
#25 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
HTML
Stelle
65
Fork
15
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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");
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.