Skip to main content

--description--

Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array.

For example, ["hello", "Hello"], should return true because all of the letters in the second string are present in the first, ignoring case.

The arguments ["hello", "hey"] should return false because the string hello does not contain a y.

Lastly, ["Alien", "line"], should return true because all of the letters in line are present in Alien.

--hints--

mutation(["hello", "hey"]) should return false.

assert(mutation(['hello', 'hey']) === false);

mutation(["hello", "Hello"]) should return true.

assert(mutation(['hello', 'Hello']) === true);

mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) should return true.

assert(mutation(['zyxwvutsrqponmlkjihgfedcba', 'qrstu']) === true);

mutation(["Mary", "Army"]) should return true.

assert(mutation(['Mary', 'Army']) === true);

mutation(["Mary", "Aarmy"]) should return true.

assert(mutation(['Mary', 'Aarmy']) === true);

mutation(["Alien", "line"]) should return true.

assert(mutation(['Alien', 'line']) === true);

mutation(["floor", "for"]) should return true.

assert(mutation(['floor', 'for']) === true);

mutation(["hello", "neo"]) should return false.

assert(mutation(['hello', 'neo']) === false);

mutation(["voodoo", "no"]) should return false.

assert(mutation(['voodoo', 'no']) === false);

mutation(["ate", "date"]) should return false.

assert(mutation(['ate', 'date']) === false);

mutation(["Tiger", "Zebra"]) should return false.

assert(mutation(['Tiger', 'Zebra']) === false);

mutation(["Noel", "Ole"]) should return true.

assert(mutation(['Noel', 'Ole']) === true);

--seed--

--seed-contents--

function mutation(arr) {
return arr;
}

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

--solutions--

function mutation(arr) {
let hash = Object.create(null);

arr[0].toLowerCase().split('').forEach(c => hash[c] = true);

return !arr[1].toLowerCase().split('').filter(c => !hash[c]).length;
}

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