Good day people.
so far i have passed a few tests but i seem to be failing the one with " Failed:mutation(["Alien", "line"])
should return true
."
any hints would be appreciated.
Your code so far
function mutation(arr) {
const lower = [];
arr.forEach(element => {
lower.push(element.toLowerCase());
//making everything lowercase
});
let firstelement = lower[0];
let secondelemnt = lower[1];
//Seperating arrays into their own variable
for (let i = 0; i < arr.length; i ++){//iterating through array
if(secondelemnt.indexOf(firstelement[i]) < 0){//comparing the arrays
return false;
}
return true;
}
};
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/104.0.0.0 Safari/537.36
Challenge: Basic Algorithm Scripting - Mutations
Link to the challenge: