2020-10-06 23:10:08 +05:30

1.8 KiB
Raw Blame History

id, challengeType, videoUrl, localeTitle
id challengeType videoUrl localeTitle
ab6137d4e35944e21037b769 5 标题案例句子

Description

返回提供的字符串每个单词的首字母大写。确保单词的其余部分为小写。出于本练习的目的您还应该将诸如“the”和“of”之类的连接词大写。如果卡住请记得使用Read-Search-Ask 。编写自己的代码。

Instructions

Tests

tests:
  - text: '<code>titleCase(&quot;I&#39;m a little tea pot&quot;)</code>应该返回一个字符串。'
    testString: assert(typeof titleCase("I'm a little tea pot") === "string");
  - text: '<code>titleCase(&quot;I&#39;m a little tea pot&quot;)</code>应该归还<code>I&#39;m A Little Tea Pot</code> 。'
    testString: assert(titleCase("I'm a little tea pot") === "I'm A Little Tea Pot");
  - text: <code>titleCase(&quot;sHoRt AnD sToUt&quot;)</code>应返回<code>Short And Stout</code> 。
    testString: assert(titleCase("sHoRt AnD sToUt") === "Short And Stout");
  - text: <code>titleCase(&quot;HERE IS MY HANDLE HERE IS MY SPOUT&quot;)</code> <code>Here Is My Handle Here Is My Spout</code> <code>titleCase(&quot;HERE IS MY HANDLE HERE IS MY SPOUT&quot;)</code>应该回到<code>Here Is My Handle Here Is My Spout</code> 。
    testString: assert(titleCase("HERE IS MY HANDLE HERE IS MY SPOUT") === "Here Is My Handle Here Is My Spout");

Challenge Seed

function titleCase(str) {
  return str;
}

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

Solution

// solution required

/section>