Mutations bonfire challenges

Mutations bonfire challenges
0.0 0

#1

Hi guys,
Are you able to explain why I cannot pass this?

Best wishes

Edy

Your code so far

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

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36.

Link to the challenge:


#2

Your code only checks the first letter of wordTwo. It returns either true or false when it checks the first letter. Remember that a return is always the end of a function. No code is executed after it.