scrimba
Frontend Career Path
Getting hired
JavaScript Interview Challenges
Challenge - toTitleCase()
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

AboutCommentsNotes
Challenge - toTitleCase()
Expand for more info
index.js
run
preview
console
/* toTitleCase
Write a function that will capitalize every word in a sentence.

Example Input: "everything, everywhere, all at once"
Example Output: "Everything, Everywhere, All At Once"
*/

/*
First, write a function that takes in one word and
capitalizes the first letter of that word.

Example Input: "scrimba"
Example Output: "Scrimba"

Hint: Trying using slice() and .toUpperCase()
*/

function capitalizeWord(word){
return;
}

/*
Now write a function that capitalizes every word in a sentence.
How can you reuse the function you just wrote?
*/

function toTitleCase(str){

}

// Test your functions
console.log(capitalizeWord("pumpkin"));
console.log(toTitleCase("pumpkin pranced purposefully across the pond"));
Console
undefined
,
undefined
,
/index.html
-0:57