Mutation exercise. code works for oth. strings but not this one. wheres my mistake. hints have indexof() instead of RegExp constructor

function mutation(arr) {
 let newArr=arr[1].split('')
let testThis;

 for(let i=0; i < newArr.length; i++){
    testThis = new RegExp(`${newArr[i]}`, 'i')
   if(testThis.test(arr[0])) {
       return true;
   return false;

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

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