I’m stuck at this challenge. My idea is to return false if there are no matches, or true if all letters are found, but for some reason I can’t return the value I need (false).
Do you know why this doesn’t work?
Here is my code:
Spoiler
function mutation(arr) {
var firstWord = arr[0].split('');
var secondWord = arr[1].split('');
secondWord.forEach(function(character) {
if (firstWord.indexOf(character) === -1) {
return false;
}
});
return true;
}
mutation(["hello", "hey"]);