I`m get stuck on Mutations

I`m get stuck on Mutations



Not work “mutation([“hello”, “hey”]) should return false” but everyone else is working.

function mutation(arr) {
var test = arr[0].toLowerCase();
var tar = arr[1].toLowerCase();
for(i = 0;i < tar.length;i++){
if (test.indexOf(tar[i]) < 0){
return false;
return true;
mutation([“hello”, “hey”]);


Instead indexOf the whole word, do it but for every letter of tar[1]. You can use method charAt(i) where for “i” you loop through every individual letter.


You’re only testing the first letter.

return exits your function. In your case you test the first letter and return either true or false based on that one test.

Look at this post for same issue

Good luck!


Also, when asking for help…

Do a quick search to see if your issue has already been answered on the forum.
That is the Search part of Read, Search, Ask

Format your code(wrap in back-ticks) so everyone can read it more easily. It is much easier to copy / paste formatted code for further testing too.

More about formatting in forum