The issue at hand involves creating a function that can determine the presence of all the letters from the second element in the array within the first element. For example, when given the arguments ["hello", "hey"], the function should return false because the word "hello" does not include the letter "y."
I attempted to solve this using the following code, however, it appears to be ineffective and I am unsure of the reason:
function mutation(arr) {
var test = arr[1].toLowerCase();
var target = arr[0].toLowerCase();
for (var i=0;i<test.length;i++) {
if (target.indexOf(test[i]) >= 0){
return true;
}
}
return false;
}