I’m not sure what is wrong in my code, but it fails one of the tests in this challenge. If anyone has any input on what is going wrong without giving the answer away. Thanks!
my code:
function mutation(arr) {
var arr1 = arr[0].toLowerCase();
var arr2 = arr[1].toLowerCase();
arr1 = arr1.split("");
arr2 = arr2.split("");
for (var i= 0; i < arr2.length; i++){
return arr1.includes(arr2[i])
}
}
console.log(mutation(["hello", "hey"]));
//return true, should be false.
console.log(mutation(["ate", "date"]));
//returns false which is correct
When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
Please use the “preformatted text” tool in the editor (</>) to add backticks around text.