2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: af2170cad53daa0770fabdea
|
2020-12-16 00:37:30 -07:00
|
|
|
|
title: 突变
|
2018-10-10 18:03:03 -04:00
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --description--
|
|
|
|
|
|
|
|
|
|
如果数组的第一个元素中的字符串包含数组第二个元素中字符串的所有字母,则返回true。例如, `["hello", "Hello"]`应该返回true,因为第二个字符串中的所有字母都出现在第一个字母中,忽略大小写。参数`["hello", "hey"]`应返回false,因为字符串“hello”不包含“y”。最后, `["Alien", "line"]`应该返回true,因为“line”中的所有字母都出现在“Alien”中。如果卡住,请记得使用[Read-Search-Ask](https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck-coding/19514) 。编写自己的代码。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --hints--
|
|
|
|
|
|
|
|
|
|
`mutation(["hello", "hey"])`应该返回false。
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['hello', 'hey']) === false);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["hello", "Hello"])`应该返回true。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['hello', 'Hello']) === true);
|
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])`应该返回true。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
|
assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']) === true);
|
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["Mary", "Army"])`应该返回true。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['Mary', 'Army']) === true);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["Mary", "Aarmy"])`应该返回true。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['Mary', 'Aarmy']) === true);
|
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["Alien", "line"])`应该返回true。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['Alien', 'line']) === true);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
`mutation(["floor", "for"])`应该返回true。
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['floor', 'for']) === true);
|
|
|
|
|
```
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["hello", "neo"])`应该返回false。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 00:37:30 -07:00
|
|
|
|
assert(mutation(['hello', 'neo']) === false);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
`mutation(["voodoo", "no"])`应该返回false。
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
assert(mutation(['voodoo', 'no']) === false);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|