Unexpected Mutations

Hello,
I cannot figure out why the following code doesn’t test [“hello”, “hey”] to false as I’d expect.

function mutation(arr) {

var arr1 = arr[0].toLowerCase();
var arr2 = arr[1].toLowerCase();


for (var ii = 0; ii < arr2.length; ii ++) {
  for (var i = 0; i < arr1.length; i++) {
    if (arr2[ii] === arr1[i]) {
      return true;
    } 
  }
  return false;
}

}

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

The logic of the code I wrote was:

  • creating two arrays from the original one
  • changing all letters to lowercase
  • looping through each array with a nested for loop and checking if entries are the same with “===”

Please note that this code passes 11 tests out of 12.
Why can’t it pass the first one?

Your function only compares first letter of each word.

you are returning if first letters are equal - a return statement when executed will stop the function
the other cases it seems the first letter is enough to give the correct answer
in this case the first letter it’s the same and it returns true but tbe expected is false

Thank you. Couldn’t see it.

I have to improve on arrays method knowledge.