I tried to solve this problem with Array.includes method.
It passes all cases, except [“hello”, “hey”] . Maybe this method is not ideal for this challenge, but I wanna know, why this code doesn’t work only for first case.
Could someone tell me why?
**Your code so far**
function mutation(arr) {
let firstLetters = [...arr[0].toLowerCase()];
let secondLetters = [...arr[1].toLowerCase()];
const comparing = (first, second)=> {
return first.includes(...second);
}
return comparing(firstLetters, secondLetters);
}
console.log(mutation(["hello", "hey"]));// why true????
console.log(mutation(["Mary", "Army"]));//true
console.log(mutation(["voodoo", "no"]))//false
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Challenge: Mutations
Link to the challenge: