I’ve got the right code, but the first test won’t show as passed. How do I move forward?
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 false;
} else {
return true;
}}}
mutation(["hello", "hey"]);
It shouldn’t return true because “hello” doesn’t contain “y”. Currently your only checking the length, you also have to make sure the first string contains all the letters of the second.