I’ve tried this a couple different ways and I think this is nearly what’s needed.
When I run a console.log of Char in the ‘for’ loop it skips the first letter if they don’t match and I don’t undertand why it’s skipping the first letter
Your code so far
function mutation(arr) {
let tester;
let firstString = arr[0].toLowerCase();
let secondString = arr[1].toLowerCase();
for (const char of secondString)
if (firstString.includes(char)) {
tester = true
}
else {
tester = false
}; return tester
};
console.log(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/143.0.0.0 Safari/537.36
Challenge Information:
Implement the Mutations Algorithm - Implement the Mutations Algorithm
Try adding couple console.log calls to try to figure out what’s happening. Ie. just before tester is returned, or what’s the tester for each character.
that’s what I tried to do but explained it really badly,
when I run console.log(char) for [hello, neo] it skips the first letter of ‘neo’ is there a way to force it to check the first letter instead of starting at the first ‘true’ iteration?