Mutations New Regex Solution

Mutations New Regex Solution
0

Tell us what’s happening:
Hi every one! I’m just finish this challenge, I thought that it had to be solved with Regex, and I did that way :joy:, but then, when I saw the solutions in the guide I realized that there were no solution like mine, maybe because I didn’t understand at all the challenge, but it’s still a solution, so how can i contribute here?

https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations/

My code worth it?

Your code so far


function mutation(arr) {
  var re = new RegExp("(?=.*" + arr[1].toLowerCase().split("").join(')(?=.*') + ")","ig");
  return re.test(arr[0]);
}

console.log(mutation(["hello", "Hey"]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations

You can take a look at the current guide on master

If you want to create a pull request to have your solution reviewed for addition in the guide, see the following docs

If you have other questions, you can visit the Contributors Gitter Room.

1 Like

Great, thank you so much for your time