Not understanding mutations

Tell us what’s happening:
Hello ! I can’t figure out why my code is returning true instead of false. Somebody can explain me what’s wrong with my ‘solution’ please.

   **Your code so far**

function mutation(arr) {
let test1 = arr[1].toLowerCase;
let test2 = arr[0].toLowerCase;
for (let i = 0; i < test1.length; i++) {
 if(test2.indexOf(test1[i]) < 0) return false;
}
return true;
}

console.log(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/90.0.4430.93 Safari/537.36.

Challenge: Mutations

Link to the challenge:

Take a closer look at lines where are defined test1 and test2. You may also try to print those values to console.

1 Like

Thanks ! you’re right, I forgot this => ()

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.