Basic Algorithm Scripting - Mutations

Tell us what’s happening:
Describe your issue in detail here.
My code works for all test but - [“hello”, “hey”]. Why is this happening?

  **Your code so far**
function mutation(arr) {
const superset = arr[0].toLowerCase().split("");
const subset = arr[1].toLowerCase().split("");
for(let i=0; i<superset.length; i++){
  if(!superset.includes(...subset)){
    console.log("false");
    return false;
  }
}
console.log("true");
return true;
}

mutation(["hello", "hey"]);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

Challenge: Basic Algorithm Scripting - Mutations

Link to the challenge:

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