Tell us what’s happening:
Im kind of stuck since a moment there. My code return true when the 1st letter’s word match the ones in the second one. Though, my “else” statement seems not to worck, since it doesnt return false when it’s false. Any advice?
Your code so far
function mutation(arr) {
//makes strings 1 & 2 split by characters
let s1 = arr[0].split("");
let s2 = arr[1].split("");
//loop to search into the array
for (let i = 0; i < arr.length; i++) {
//check if I can find the letters in the 1st word, in the second one.
if (arr[0].indexOf(arr[2] == true)){
return true;
}else{
return false;
}
}
}
mutation(["hello", "CAPS"]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0
.
Link to the challenge: