Hello, all.
I am running into trouble with one of the exercises and I hope that one of you will help me to see what I am missing.
The exercise that I’m running into confusion with is here: Basic Algorithm Scripting: Mutations
The code below passes all but one of the tests and I am hoping for insight that will help me to think more clearly about suitable approaches to this problem. As always, any input will be greatly appreciated.
function mutation(arr) {
let firstEl = arr[0].toLowerCase();
let secondEl = arr[1].toLowerCase();
for (var i = 0; i < secondEl.length; i++) {
if (firstEl.indexOf(secondEl[i]) !== -1) {
return true;
}
return false;
}
}