Hi
Can someone help me see why my code is not working for the first example?
Iโve checked other examples but canโt see the difference.
My code is a bit long but it shows my thinking process. (Still learning that nice simplified clean code )
function mutation(arr) {
var string1 = arr.slice(0,1).toString().toLowerCase();
var string2 = arr.slice(1).toString().toLowerCase();
var array1 = string1.split('');
var array2 = string2.split('');
for (i = 0; i < array2.length; i++) {
var result = array1.indexOf(array2[i]);
if (result >= 0){
return true;
} else {
return false;
}
}
}
mutation(["hello", "hey"]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/mutations