Hello, everyone,
I need some advice with this challenge.
I am hacking at it bit by bit as I usually do, using console.log within the function to test if the output is getting me closer.
The problem is that even that is not working.
I have added a “console.log(arr2.lenght);” and its output is blank, literally.
As you can see in the code, there are 2 console.log testers.
Currently the output is exactly this:
"
false
"
A blank space followed by false on the next row.
What am I doing wrong here?
Thank you!
Your code so far
function mutation(arr) {
var counter = 0;
let arr1 = arr[0].toLowerCase().split('');
let arr2 = arr[1].toLowerCase().split('');
console.log(arr2.lenght);
for (var i = 0; i < arr2.lenght; i++) {
if (arr1.includes(arr2[i]) == true) {
console.log(i);
counter += 1;
}
}
if (counter == arr2.lenght) {
return true;
}
return false;
}
console.log(mutation(["Hello", "hey"]));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36
.
Link to the challenge: