-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathtoTitleCase.js
30 lines (26 loc) · 950 Bytes
/
toTitleCase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* Given an input string, returns a copy of the string in title case.
*
* For our purposes, title case is words separated by spaces with the
* first letter of each word being capitalized and every other letter
* being lowercsae.
*
* Don't do anything special with non-alphabetic characters (numbers,
* puncuation, etc.). Don't worry about special rules like not capializing
* definite articles (a, an, the, etc).
*
* @example
* toTitleCase('wElCoMe to THE wILD wiLD WEST!'); // => 'Welcome To The Wild Wild West!'
*
* @param {string} string - The string to replace a character in
* @returns {string} A lowercase copy of the input string
*/
function toTitleCase(string) {
// This is your job. :)
}
if (require.main === module) {
console.log('Running sanity checks for toTitleCase:');
// Add your own sanity checks here.
// How else will you be sure your code does what you think it does?
}
module.exports = toTitleCase;