JavaScript: Mutations

What’s happening: I think my code is correct. I tested the function in the console and I can see the expected output.

I found this typo in the expected results (no closing parenthesis):
Might this be causing the error?

My code so far

function mutation(arr) {

let first = arr[0].toLowerCase();

for (letter in arr[1]) { //Iterate through the letters in the second string.
  if (first.indexOf(arr[1][letter].toLowerCase()) === -1) {
    return false; //For every letter, if it's not contained in the first string, return false.
return true; //Else, return true.

Your browser information:

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

Challenge: Mutations

Link to the challenge:

remember you need to declare all variables.

where is letter declared?

I was going to delete the post, I saw it in the console just now…


…I come from python and still have to get used to declaring variables :sweat_smile:.

Thank you so much for your feedback! :slight_smile:

1 Like