# Basic Algorithm Scripting - Mutations

### Tell us what’s happening:

Describe your issue in detail here.

``````function mutation(arr) {
return arr;
}

mutation(["hello", "hey"]);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 YaBrowser/23.11.0.0 Safari/537.36`

### Challenge Information:

Basic Algorithm Scripting - Mutations

``````function mutation(arr) {
if(arr[0].toLowerCase === arr[1].toLowerCase){
console.log(arr[1])
return true
}

return arr;
}

mutation(["hello", "hey"]);
``````

I understand that they won’t be able to explain here))) but my code doesn’t work, the hint shows solutions to complex code and this is very bad, a beginner is not interested in such solutions, my solution seems clear and simple, but of course it doesn’t work, the reason is unknown to me .

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

The arguments `["hello", "hey"]` should return `false` because the string `hello` does not contain a `y`.

Start simple, solve the above problem first. Right now your code returns “hey” but it should return `false` because “hello” does not contain all of the letters in “hey” (there’s no “y”)

Modify your console log like this:
`console.log(arr[0].toLowerCase, arr[0].toLowerCase)`
And you will see why your function always returns True.

What will be your approach to comparing each letter in the second word to the first word?

It returns for me, it’s not clear at all why this happens, why does it return the method? if the method is given values? and it was supposed to return values in lower case, how can I understand?

I had a mistake as well, change your console.log line to this:
`console.log(arr[0].toLowerCase, arr[1].toLowerCase)`

Double check your syntax of that method:
https://www.w3schools.com/jsref/jsref_toLowerCase.asp

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.