My code only can check the first element, but it is the same as the answer when I compare it with the answer. Did anyone know why?
function mutation(arr) {
let arrl = arr[0].toLowerCase()
let arrl2 = arr[1].toLowerCase()
for (let i=0;arrl2.length>=i;i++){
if(arrl.indexOf(arrl2[i])<0){return false;}
return true
}}
console.log(mutation(["helLo", "hy"]))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Mutations
Link to the challenge: