Mutations - can not test one test

Hello,

I post here but I don’t know if I’m supposed to open a new channel for my problem or jump in the post on the same challenge from another member.

I’ve tried many different approach but there is always something that doesn’t work …
The latest below has just one test that doesn’t pass, I don’t know why


function mutation(arr) {
  
  if (arr[0] > arr[1]) {
    for (i = 0; i < arr[1].length; i++) {
      if (arr[0].toLowerCase().indexOf(arr[1][i].toLowerCase()) !== - 1) {
        return true;
      }      
      return false;
    }
  }
  
  if (arr[0] < arr[1]) {
    for (i = 0; i < arr[1].length; i++) {
      if (arr[0].toLowerCase().indexOf(arr[1][i].toLowerCase()) !== - 1) {
        return true;
      }      
      return false;
    }
  } 
}

mutation(["hello", "hey"]);

image

Hey sorry for late reply, I wasn’t home last day

If i understood your point, i’m comparing a string with a letter.
I’ve try to access arr[0][0] but it doesn’t work
I’ve tested with arr[0][i] but it doesn’t work too as I supposed

I’m also curious, when i return true in

 for (i = 0; i < arr[1].length; i++) {
      if (arr[0].toLowerCase().indexOf(arr[1][i].toLowerCase()) !== - 1) {
        return true;
}

Does the function goes though every value of i or does it just take i = 0 and return true or false ?
A friend told me that return end the function