2020-09-21 20:51:46 +05:30

2.6 KiB
Raw Blame History

id, title, challengeType, videoUrl, localeTitle
id title challengeType videoUrl localeTitle
af2170cad53daa0770fabdea Mutations 5 突变

Description

如果数组的第一个元素中的字符串包含数组第二个元素中字符串的所有字母则返回true。例如 ["hello", "Hello"]应该返回true因为第二个字符串中的所有字母都出现在第一个字母中忽略大小写。参数["hello", "hey"]应返回false因为字符串“hello”不包含“y”。最后 ["Alien", "line"]应该返回true因为“line”中的所有字母都出现在“Alien”中。如果卡住请记得使用Read-Search-Ask 。编写自己的代码。

Instructions

Tests

tests:
  - text: '<code>mutation([&quot;hello&quot;, &quot;hey&quot;])</code>应该返回false。'
    testString: assert(mutation(["hello", "hey"]) === false);
  - text: '<code>mutation([&quot;hello&quot;, &quot;Hello&quot;])</code>应该返回true。'
    testString: assert(mutation(["hello", "Hello"]) === true);
  - text: '<code>mutation([&quot;zyxwvutsrqponmlkjihgfedcba&quot;, &quot;qrstu&quot;])</code>应该返回true。'
    testString: assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true);
  - text: '<code>mutation([&quot;Mary&quot;, &quot;Army&quot;])</code>应该返回true。'
    testString: assert(mutation(["Mary", "Army"]) === true);
  - text: '<code>mutation([&quot;Mary&quot;, &quot;Aarmy&quot;])</code>应该返回true。'
    testString: assert(mutation(["Mary", "Aarmy"]) === true);
  - text: '<code>mutation([&quot;Alien&quot;, &quot;line&quot;])</code>应该返回true。'
    testString: assert(mutation(["Alien", "line"]) === true);
  - text: '<code>mutation([&quot;floor&quot;, &quot;for&quot;])</code>应该返回true。'
    testString: assert(mutation(["floor", "for"]) === true);
  - text: '<code>mutation([&quot;hello&quot;, &quot;neo&quot;])</code>应该返回false。'
    testString: assert(mutation(["hello", "neo"]) === false);
  - text: '<code>mutation([&quot;voodoo&quot;, &quot;no&quot;])</code>应该返回false。'
    testString: assert(mutation(["voodoo", "no"]) === false);

Challenge Seed

function mutation(arr) {
  return arr;
}

mutation(["hello", "hey"]);

Solution

// solution required

/section>