Answers for "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"

0

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

function mutation(arr) {
  var arr1 = arr[0].toLowerCase().split('');
    var arr2 = arr[1].toLowerCase().split('');
    var count = 0;
    for (let i =0; i < arr2.length; i++) {
        if(arr1.indexOf(arr2[i]) > -1 ) {
            count++;
        }
    }
  return count == arr2.length
}

mutation(["hello", "hey"]);
Posted by: Guest on July-16-2021

Code answers related to "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"

Browse Popular Code Answers by Language