Tell us what’s happening:
Describe your issue in detail here.
Only one test is failing and I am not getting it why ?
Your code so far
let res=mutation(["ate", "date"]);
Your browser information:
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/188.8.131.52 Safari/537.36
Basic Algorithm Scripting - Mutations
Hi @kedar.webdev !
Here is the issue with your code
You don’t need this if/else statement here
It is fine to convert everything to lowercase but you don’t need an if/else statement like you have here.
Remove all of that and just convert the two words to all lowercase.
So essentially, just keep this part here
then the tests should pass
Yes it works thanks but need details on “includes” method. I thought like this,
Also I didn’t get how “ate” and “date” shall be false because “ate” is available in “date”?
First, I do want to commend you on your thinking with this challenge. You adapted a clever solution. But, to answer your most recent question, the challenge is specific in its verbiage on how to complete it:
It doesn’t ask you to compare lengths and swap around the position of the first and second word based on their lengths. It says to return true only if all of the letters in the first element of the array contain all of the letters in the second element.
Since, in the test, “date” is the 2nd word and “ate” is the first word, “date” has an extra d that is not in “ate” and should return false. That’s why @jwilkins.oboe said to remove the if/else logic that swaps around which word is first and which is second, because it’s not applicable to this challenge.