I’m aware that solutions use indexOf() and I will get started solving it that way but I started solving it with like this and I just want to finish it lol.
function mutation(arr) {
var firstArr=arr[0].toLowerCase().split("");
var secondArr=arr[1].toLowerCase().split("");
var k=[];
for(var i=0;i<firstArr.length;i++){
for(var j=0;j<secondArr.length;j++){
if (firstArr[i]==secondArr[j]){
k++;
}
}}
return k==secondArr.length;
}
I have gotten most of the cases correct except that my counter K doesn’t take into account if the same letter is counted more than once like the “l” in hello. I want to know if there is even anything I can do to fix that. I tried figuring it out but I need some help. Thanks!