-- Mutations --

-- Mutations --
0

#1

Tell us what’s happening: So it seems like this isn’t working because arr[0] does not contain all of arr[1]?How do I say “if arr[0] contains any amount of arr[1] in any order: return true”?

How would you edit my code in the least amount possible to get it to work? Am I somewhat on the right track with the approach I’ve taken?

Your code so far

function mutation(arr) {
  var x = arr[0].toLowerCase('');
  var y = arr[1].toLowerCase('');
  var xx = x.split('');
  var yy = y.split('');
  
  if (xx.includes(yy)) {
    return true;
  }
  
  return false;
}
mutation(["Mary", "Aarmy"]);

Link to the challenge:


#2

I think you are not quite on the right track so I’m not going so suggest a solution. However, you should have a look at the documentation for includes() again, from the MDN documentation:

The includes() method determines whether an array includes a certain element, returning true or false as appropriate.

Both xx and yy are both arrays, so I wouldn’t expect your code to work because what you have done is effective asking if an array is present in another array, instead of asking whether or not an element is present in an the array specified. For example, xx.includes('a') would return true. I hope that helps. :slight_smile: