Mutations... correct code won't clear first test

Mutations... correct code won't clear first test
0

#1

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"]);

#2

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.


#4

Your code checks only the first letter and then returns.


#5

I can’t see why that one won’t work.


#6

Thank you. I think I’ll have to come back to it in the morning.


#7

A post was split to a new topic: Mutations can not pass 1st test