Mutations Code Review

Hi all my code works with 4 attempts. Looking for any reviews that maybe helpful to understand why it’s not working with the rest of the attempts.

ie I don’t understand why mutation([“floor”, “for”]) does not return true; while mutation([“Mary”, “Army”]) does return true.

Your code so far

     arr.map(function(x){ return x.toLowerCase() })
     var elem0 = arr[0]; 
     var elem1 = arr[1]; 
     var arrElem1 = elem1.split("");
     var arrIndex = [];
     for (i = 0; i < arrElem1.length; i++) {
        var arrSubElem1 = arrElem1[i];
        var arrSubIndex = elem0.indexOf(arrSubElem1);
        arrIndex.push(arrSubIndex);
        
     }
    if(arrIndex.indexOf(-1)){
        return false;} else {
            return true;}
    
}

mutation(["floor", "for"])  

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0.

Link to the challenge:
https://www.freecodecamp.org/challenges/mutations