mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-31 06:01:50 -05:00
1.0 KiB
1.0 KiB
id, title, challengeType, forumTopicId
| id | title | challengeType | forumTopicId |
|---|---|---|---|
| ab6137d4e35944e21037b769 | 句中单词首字母大写 | 5 | 16088 |
--description--
请将传入的字符串中,每个单词的第一个字母变成大写并返回。注意除首字母外,其余的字符都应是小写的。
另外请注意,像是 “the”、“of” 之类的连接词的首字母也要大写。
--hints--
titleCase("I'm a little tea pot") 应返回一个字符串。
assert(typeof titleCase("I'm a little tea pot") === 'string');
titleCase("I'm a little tea pot") 应返回 I'm A Little Tea Pot。
assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot");
titleCase("sHoRt AnD sToUt") 应返回 Short And Stout。
assert(titleCase('sHoRt AnD sToUt') === 'Short And Stout');
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") 应返回 Here Is My Handle Here Is My Spout。
assert(
titleCase('HERE IS MY HANDLE HERE IS MY SPOUT') ===
'Here Is My Handle Here Is My Spout'
);