freeCodeCamp/curriculum/challenges/russian/02-javascript-algorithms-an.../basic-algorithm-scripting/mutations.russian.md

3.3 KiB
Raw Blame History

id title isRequired challengeType videoUrl localeTitle
af2170cad53daa0770fabdea Mutations true 5 Мутации

Description

Возвращает true, если строка в первом элементе массива содержит все буквы строки во втором элементе массива. Например, ["hello", "Hello"] должен возвращать true, потому что все буквы во второй строке присутствуют в первом, игнорирующем случае. Аргументы ["hello", "hey"] должны возвращать false, потому что строка "hello" не содержит "y". Наконец, ["Alien", "line"] должен возвращать true, потому что все буквы в «строке» присутствуют в «Alien». Не забудьте использовать Read-Search-Ask, если вы застряли. Напишите свой собственный код.

Instructions

Tests

tests:
  - text: '<code>mutation([&quot;hello&quot;, &quot;hey&quot;])</code> должна возвращать false.'
    testString: 'assert(mutation(["hello", "hey"]) === false, "<code>mutation(["hello", "hey"])</code> should return false.");'
  - text: '<code>mutation([&quot;hello&quot;, &quot;Hello&quot;])</code> должна возвращать true.'
    testString: 'assert(mutation(["hello", "Hello"]) === true, "<code>mutation(["hello", "Hello"])</code> should return true.");'
  - text: ''
    testString: 'assert(mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) === true, "<code>mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])</code> should return true.");'
  - text: ''
    testString: 'assert(mutation(["Mary", "Army"]) === true, "<code>mutation(["Mary", "Army"])</code> should return true.");'
  - text: ''
    testString: 'assert(mutation(["Mary", "Aarmy"]) === true, "<code>mutation(["Mary", "Aarmy"])</code> should return true.");'
  - text: ''
    testString: 'assert(mutation(["Alien", "line"]) === true, "<code>mutation(["Alien", "line"])</code> should return true.");'
  - text: '<code>mutation([&quot;floor&quot;, &quot;for&quot;])</code> должна возвращать true.'
    testString: 'assert(mutation(["floor", "for"]) === true, "<code>mutation(["floor", "for"])</code> should return true.");'
  - text: ''
    testString: 'assert(mutation(["hello", "neo"]) === false, "<code>mutation(["hello", "neo"])</code> should return false.");'
  - text: '<code>mutation([&quot;voodoo&quot;, &quot;no&quot;])</code> возвращает false.'
    testString: 'assert(mutation(["voodoo", "no"]) === false, "<code>mutation(["voodoo", "no"])</code> should return false.");'

Challenge Seed

function mutation(arr) {
  return arr;
}

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

Solution

// solution required