Can you please help me figure out problem

Can you please help me figure out problem
0

#1

Tell us what’s happening:

Your code so far

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

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/66.4.134 Chrome/60.4.3112.134 Safari/537.36.

Link to the challenge:


#2

Hey @dbinh,
take a good look at your if clause inside the second for loop. If the letter is found inside arr[0] then you are returning true. You are not checking all of the letters, only the first letter.
I will not give you the solution here, but try to think of a way to only return true once you have checked ALL the letters.

Good luck.