Basic Algorithm Scripting - Mutations

Tell us what’s happening:
my count stops increasing after first iteration

Your code so far

function mutation(arr) {
  const splittedFirstElement = arr[0].split("");
  const splittedSecondElement = arr[1].split("");
    let count = 0;
  for(let i = 0; i < splittedSecondElement.length; i++){
    var a = 0;
      if(splittedSecondElement[i] == splittedFirstElement[a]){
    } while(splittedSecondElement[i] != splittedFirstElement[a] && a < splittedFirstElement.length)
        a = 0;
  if(count >= splittedSecondElement.length){
    return true;
    return false;

console.log(mutation(["voodoo", "no"]));

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:

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

im unable to match lowercase letters to uppercase letters
is there a special character I can use to so

Do you remember the toLowerCase() method?

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