Mutations please help

Mutations please help
0

#1

Tell us what’s happening:
This is what I had for this quiz but it passed only false. Please help. Thank you:grinning:

Your code so far

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

  }
}

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36.

Link to the challenge:


#2

With regard to your question, I think it’s just a typo. The following part of the code:

elementOne.indexOf(elementTwo[i] === -1)

… should instead be:

elementOne.indexOf(elementTwo[i]) === -1

There is one small problem left, as you will find out after fixing that part of the code, but you should be able to spot that! I hope that helps. :smile:


#3

Thank you. I passed it.