Tell us what’s happening:
Describe your issue in detail here.
I think I make correct use ofArray.prototype.indexOf() but am still getting errors can someone explain to me what’s wrong with my code.
**Your code so far**
function mutation(arr) {
let arr1 = arr[0].toLowerCase().split('');
let arr2 = arr[1].toLowerCase().split('');
for (let i = 0; i < arr1.length; i++) {
// console.log(arr2.indexOf(arr1[i]))
if (arr2.indexOf(arr1[i]) === -1 ){
return false
}
return true
}
}
let ans = 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/92.0.4515.159 Safari/537.36
Challenge: Mutations
Link to the challenge: