2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: af2170cad53daa0770fabdea
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
localeTitle: 突变
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-06-30 01:51:26 -07:00
|
|
|
|
<section id="description">如果数组的第一个元素中的字符串包含数组第二个元素中字符串的所有字母,则返回true。例如, <code>["hello", "Hello"]</code>应该返回true,因为第二个字符串中的所有字母都出现在第一个字母中,忽略大小写。参数<code>["hello", "hey"]</code>应返回false,因为字符串“hello”不包含“y”。最后, <code>["Alien", "line"]</code>应该返回true,因为“line”中的所有字母都出现在“Alien”中。如果卡住,请记得使用<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>mutation(["hello", "hey"])</code>应该返回false。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["hello", "hey"]) === false);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["hello", "Hello"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["hello", "Hello"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["Mary", "Army"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["Mary", "Army"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["Mary", "Aarmy"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["Mary", "Aarmy"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["Alien", "line"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["Alien", "line"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["floor", "for"])</code>应该返回true。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["floor", "for"]) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["hello", "neo"])</code>应该返回false。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["hello", "neo"]) === false);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: '<code>mutation(["voodoo", "no"])</code>应该返回false。'
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(mutation(["voodoo", "no"]) === false);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function mutation(arr) {
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mutation(["hello", "hey"]);
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
|
|
|
|
/section>
|