Basic Algorithm Scripting - Mutations

Hey Guys,
I was trying to code this problem using If and else statement. As well as I have included a .includes() function.
When I run this code I am getting either result as true or as false.
What should I change or where I am wrong? Help me regarding the same and where I am wrong also tell this(so I can study it).
Thank You in advance
Your code so far

function mutation(arr) {
   const d = arr[0].toLowerCase();
   const e = arr[1].toLowerCase();
   const f = d.includes(e)
    if(f == false){
      return true;
    else if(f == true){
      return false;
    //return false;

mutation(["hello", "Hey"]);

Your browser information:

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

Challenge: Basic Algorithm Scripting - Mutations

Link to the challenge:

Hi, is this an fCC challenge?
Can you provide a link to the challenge description?

you need to check each letter individually, i think you are checking the whole words.
you might want to use some loop over each letter, although some use of .includes() might work i’m not sure.
you can check in get a hint if you need.

IIt really helps if you use meaningful variable names.

Includes checks for a matching substring, but the instructions want to know if the letters are present in any order.

1 Like

Link to the challenge:

I tried using .split(“”) also. But didn’t worked!
In hint/ solution section I am not able to understand the working of for loop. But will try again

okay thanks,
So any other way to do this?

I would check for each letter individually.

try get hint, i think they put 3 for this one

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