Tell us what’s happening:
Hi All,
could you please explain why this code is not working only for example with “hello” and “hey”?
It is interesting with other examples everything is fine
Thank you!
Your code so far
function mutation(arr) {
var arr1 = arr[0].split('');
var arr2 = arr[1].split('');
arr1 = arr1.map(v => v.toLowerCase());
arr2 = arr2.map(v => v.toLowerCase());
for (var i = 0; i <= arr2.length - 1; i++) {
if (arr1.includes(arr2[i])) {
} else {
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/80.0.3987.149 Safari/537.36
.
Challenge: Mutations
Link to the challenge: