Mutations Basic Algorithm Scripting

Tell us what’s happening:
What am i doing wrong can anyone please guide me thanks :slight_smile:

  **Your code so far**

function mutation(arr) {
// convering to str
let tostr = arr.toString();

// lower case
let lower = tostr.toLowerCase();

for(let i = 0; i < lower.length; i++){
if(lower.indexOf(arr[0]) === lower.indexOf(arr[1])){
return true;
}else{
return false;
}
}
}

mutation(["hello", "Hello"]);
  **Your browser information:**

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

Challenge: Mutations

Link to the challenge:

can you please explain the logic you are using in your algorithm?

1 Like

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