My "Mutation" challenge solution passes ALL tests except ONE. Why?

Tell us what’s happening:

My “Mutation” challenge solution passes all tests except ONE - the very first one : mutation([“hello”, “hey”]);

It passes the very similar test : mutation([“hello”, “neo”]); but not : mutation([“hello”, “hey”]);

What is wrong with it? Pease, Help. I’m desperate!

Your code so far


function mutation(arr) {

const container = arr[0].toLowerCase();
const test = arr[1].toLowerCase();

for (let i = 0; i < test.length; i++) {

return container.includes(test[i]);

}
}

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36

Challenge: Mutations

Link to the challenge:

this does exactly the same thing as

return container.includes(test[0])

the others all accidentally pass

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.