Hey guys, I don’t really know why my code isn’t working. It looks like it only checks the first character of the second element of ‘arr’, despite me using the ‘for loop’. I checked a couple of solutions and was able to make mine work with ‘if’ statement but still don’t understand why isn’t this a correct solution. Please help me find the problem, all comments are appreciated!
Your code so far
function mutation(arr) {
var arr0 = arr[0].toLowerCase();
var arr1 = arr[1].toLowerCase().split('');
var i;
for (i = 0; i < arr1.length; i++) {
return (arr0.indexOf(arr1[i]) >= 0);
}
}
mutation(["hello", "hey"]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
.
Link to the challenge: