Tell us what’s happening:
I am trying to use regular expressions to solve this. I run into an error on the return statement indicating that arr[0].test is not a function.
Can anyone help me understand why this is not working?
Thanks,
Your code so far
function mutation(arr) {
let testStr = `[${arr[1]}]`;
let testRE = new RegExp(testStr, 'ig');
return arr[0].test(testRE);
}
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/68.0.3440.106 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations