Can anyone tell me why this code doesn’t work? It passes on every test except the [‘hello’, ‘hey’] one.
function mutation(arr) {
var strArr=[arr[0].toLowerCase(), arr[1].toLowerCase()];
for (var i = 0; i < strArr[1].length; i++) {
if (strArr[0].indexOf(strArr[1][i]) < 0) {
return false;
}
return true;
}
}
mutation(["hello", "hey"]);
I have looked through the forum for solutions and they all seem to be the same as my code above. Sorry if I’ve missed something simple. but I would appreciate being pointed in the right direction.
Thank you.