Tell us what’s happening:
Describe your issue in detail here.
I’ve tried solving this problem using regular expression and almost all of the questions are working perfectly, except three. Can someone help me here?
**Your code so far**
function mutation(arr) {
//the word
let toSearch=[...arr[0].toLowerCase()].sort().join("");
//the word to be searched
let pattern=[...arr[1].toLowerCase()].sort().join("");
console.log(toSearch,pattern)
//using regexp to find if it exists or not
let check= new RegExp(pattern,"ig");
let result=check.test(toSearch);
//return the result
return result
}
mutation(["hello", "hey"]);
**Your browser information:**
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36
Challenge: Mutations
Link to the challenge: