Mutations help needed

Tell us what’s happening:
Everything is returning true and i can’t figure out why

Your code so far

function mutation(arr) {
  var arr1 = arr[0].split();
  var arr2 = arr[1].split();
  var test = 0;
    for (var i = 0; i < arr2.length; i++){
      for (var j = 0; j < arr1.length; j++){
        if (arr2[i] = arr1[j]){
  if (test = arr[1].length){
    return true;
  else {
    return false;

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10452.99.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.203 Safari/537.36.

Link to the challenge:

The = is an assigment operator, not a comparison one (== or ===).

It seems that the assigment that you put in the if condition evaluates as true, so the execution goes into the if branch that returns true.

1 Like

I think you forgot to define the seperator for the split also. It should be given “” as the input in order to split by character (which I think is what you wanted).
This is the documentation explaining this:


Agh!! Thank you so much! The solution is always so simple in hindsight!!

Yes i did!! Thank you!! That helped a lot!!

1 Like