Mutations -Code feedback

Mutations -Code feedback
0

#1

Tell us what’s happening:

Why does this code not work??

How am i using the methods wrong? Or is it just what i’m trying to do is wrong?

Your code so far

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

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

Your browser information:

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

Link to the challenge:


#2

Nevermind.

used hint and changed to lower case in a separate string.