Tell us what’s happening:
all outputs are correct apart from the last two, i can’t get it where is my mistake
Your code so far
function mutation(arr){
const firstEl = arr[0].toLowerCase();
const secondEl = arr[1].toLowerCase();
let val;
for(let char of secondEl){
console.log(char)
if(!firstEl.includes(char)){
val = false;
} else{
val = true;
}
}
return val;
}
console.log(mutation(["Hello", "hello"])); // output: true
console.log(mutation(["Hello", "hey"])); // output: false
console.log(mutation(["Alien", "line"])); //output: true
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Implement the Mutations Algorithm - Implement the Mutations Algorithm
dhess
March 4, 2026, 2:02pm
2
mutation(["hello", "neo"])
When your code sees that “n” is not included in “hello”, it sets val to false, but does it stop there? Or does it evaluate “e” and set val to true?
Tell us what’s happening:
all outputs are correct apart from the last two, i can’t get it where is my mistake
Your code so far
function mutation(arr){
const firstEl = arr[0].toLowerCase();
const secondEl = arr[1].toLowerCase();
let val;
for(let char of secondEl){
console.log(char)
if(!firstEl.includes(char)){
val = false;
} else{
val = true;
}
}
return val;
}
console.log(mutation(["Hello", "hello"])); // output: true
console.log(mutation(["Hello", "hey"])); // output: false
console.log(mutation(["Alien", "line"])); //output: true
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Implement the Mutations Algorithm - Implement the Mutations Algorithm
dhess
March 4, 2026, 2:06pm
4
In the future, please don’t create a duplicate topic for the same challenge/step. Just be patient. Someone here will help you when they are available. I’ve merged the post from your duplicate into this existing thread.
Sorry for that, it was my first time here I accidently created duplicate topic. I tried to delete it but i couldn’t find option for that.
dhess
March 4, 2026, 2:11pm
6
No worries. I thought you were trying to bump it…my mistake.
Happy coding!