JSFiddle - React, Tailwind, and code Playground

HTML

zadanie:<br><br>

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.<br><br>

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

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

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

mutation(["hello", "hey"]) should return false.<br>
mutation(["hello", "Hello"]) should return true.<br>
mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) should return true.<br>
mutation(["Mary", "Army"]) should return true.<br>
mutation(["Mary", "Aarmy"]) should return true.<br>
mutation(["Alien", "line"]) should return true.<br>
mutation(["floor", "for"]) should return true.<br>
mutation(["hello", "neo"]) should return false.<br>
mutation(["voodoo", "no"]) should return false.<br>

JavaScript

function mutation(arr) {
  var input01 = arr[0].toLowerCase();
  var input02 = arr[1].toLowerCase();
  
  var input2 = input02.split("");
  
  var array = [];
  for (i = 0; i < input2.length; i++) {
    array.push(input01.indexOf(input2[i]));
  }
  
  

  for (i = 0; i < array.length; i++) {
    if(array[i] < 0){
      return false;
    } else {
      return true;
    }
  }

}

mutation(["hello", "hey"]); //powinno być false a daje true :/