Tell us what’s happening:
Hi fellow campers!
I feel I am very close to solving this but I can’t figure out how to return false the three other conditions of :
mutation([“hello”, “hey”]) should return false.
mutation([“hello”, “neo”]) should return false.
mutation([“voodoo”, “no”]) should return false.
any help without giving the answer so I can learn and understand? Thank you in advance!
Your code so far
function mutation(arr) {
var newArr1 = arr[0].toLowerCase().split("");
var newArr2 = arr[1].toLowerCase().split("");
for (var i = 0; i < newArr1.length; i++) {
for (var j = 0; j < newArr2.length; j++) {
if (newArr1.indexOf(newArr1, 0) === newArr2.indexOf(newArr2, 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_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36
.
Link to the challenge: