2018-10-10 18:03:03 -04:00
|
|
|
---
|
|
|
|
id: a103376db3ba46b2d50db289
|
|
|
|
title: Spinal Tap Case
|
|
|
|
isRequired: true
|
|
|
|
challengeType: 5
|
|
|
|
videoUrl: ''
|
|
|
|
localeTitle: 脊椎龙头套
|
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
2020-06-30 01:51:26 -07:00
|
|
|
<section id="description">将字符串转换为脊柱案例。脊柱情况是全小写单词连接的破折号。如果卡住,请记得使用<a href="https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck-coding/19514" target="_blank">Read-Search-Ask</a> 。尝试配对程序。编写自己的代码。 </section>
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id="instructions">
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
|
|
|
tests:
|
|
|
|
- text: <code>spinalCase("This Is Spinal Tap")</code>应该返回<code>"this-is-spinal-tap"</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.deepEqual(spinalCase("This Is Spinal Tap"), "this-is-spinal-tap");
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: <code>spinalCase("thisIsSpinal Tap")</code>应该返回<code>"this-is-spinal-tap"</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.strictEqual(spinalCase('thisIsSpinalTap'), "this-is-spinal-tap");
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: <code>spinalCase("The_Andy_ Griffith_Show")</code>应该返回<code>"the-andy-griffith-show"</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.strictEqual(spinalCase("The_Andy_Griffith_Show"), "the-andy-griffith-show");
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: <code>spinalCase("Teletubbies say Eh-oh")</code>应该返回<code>"teletubbies-say-eh-oh"</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.strictEqual(spinalCase("Teletubbies say Eh-oh"), "teletubbies-say-eh-oh");
|
2018-10-10 18:03:03 -04:00
|
|
|
- text: <code>spinalCase("AllThe-small Things")</code>应该归还<code>"all-the-small-things"</code> 。
|
2020-02-18 01:40:55 +09:00
|
|
|
testString: assert.strictEqual(spinalCase("AllThe-small Things"), "all-the-small-things");
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function spinalCase(str) {
|
|
|
|
// "It's such a fine line between stupid, and clever."
|
|
|
|
// --David St. Hubbins
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
spinalCase('This Is Spinal Tap');
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
|
|
/section>
|