# Mutations(solution spoiler)

**URL:** <https://forum.freecodecamp.org/t/mutations-solution-spoiler/30107>\
**Category:** General\
**Created:** [August 22, 2016, 12:41am UTC](https://forum.freecodecamp.org/t/mutations-solution-spoiler/30107 "2016-08-22T00:41:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aledwassell](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@aledwassell](https://forum.freecodecamp.org/u/aledwassell)\
**Post date:** [August 22, 2016, 12:41am UTC](https://forum.freecodecamp.org/t/mutations-solution-spoiler/30107/1 "2016-08-22T00:41:40Z")

</div>

Oh okay so you need to make the if statement compare wordOne.indexOf(wordTwo[i]) \< 0

less than 0, I was strictly comparing it to -1, didn’t work for hello and hey still slightly confused about indexOf, ill go back and look over MDN again

function mutation(arr) {

var wordOne = arr[0];  
wordOne = wordOne.toLowerCase().split(’’);  
var wordTwo = arr[1];  
wordTwo = wordTwo.toLowerCase().split(’’);

for (var i = 0; i \< wordTwo.length; i++){  
if (wordOne.indexOf(wordTwo[i]) \< 0) {  
return false;  
}  
}  
return true;  
}

mutation([“Hello”, “Hey”]);

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 5:28am UTC](https://forum.freecodecamp.org/t/mutations-solution-spoiler/30107/2 "2021-01-16T05:28:58Z")

</div>

Closed on January 16, 2021, 5:28am UTC


