Tell us what’s happening:
Hi Everybody,
My console returns to me : Invalid flags supplied to RegExp constructor ‘a’.
I would like to understand what’s wrong?
The purpose of this function is to match the arr[1] arg into the arr[0] arg , unsorted.
Your code so far
function mutation(arr) {
let cut = arr[1].split('');
let cut2 = arr[0].split('');
var regex = new RegExp(...cut, '\gi');
var result = regex.test(...cut2);
console.log(result);
}
mutation(["Mary", "Aarmy"]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.