Using .includes()

Hey guys, I have just one question. I keep failing just one test (first one → " mutation(["hello", "hey"]) should return false") on the challenge and I have no idea why. I saw the solutions of the problem but none of them looks like mine so I can not compare it to anything. I decided to use .indludes() syntax because I wanted to keep the solution minimal and not chaotic.

  **Your code so far**

function mutation(arr) {
for (let i = 0; i < arr[1].length; i++) {
  return (arr[0].toLowerCase().includes(arr[1][i].toLowerCase())) 

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/91.0.4472.124 Safari/537.36

Challenge: Mutations

Link to the challenge:

Your code only checks the first letter of the second word because of the return statement.
So it checks if the letter h of the word hey is included in hello and it returns true.

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