Failing five tests

Tell us what’s happening:

What’s wrong with this code? I have written the code and it fails the following tests:

I dont know why? Can anyone suggest something?

Your code so far


function mutation(arr) {

// Step 1: Loop through all the element of the first element of the array


for (let i = 0; i < arr[1].length; i++) {
  // console.log(arr[1].length);

  if (typeof(arr[0].toString().toLowerCase().indexOf(arr[1][i].toString().toLowerCase())) == 'number') {
    console.log(arr[0].toString().toLowerCase().indexOf(arr[1][i].toString().toLowerCase()))
    return true;
  }
  else {
    return false;
  }
}
 
// Step 2: Compare the second element to the first element using substring
}
mutation(["hello", "hey"]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Mutations

Link to the challenge: