Type Error is not a function

Tell us what’s happening:
Hello, I dont understand why i’m getting a Error, of r.sreach is not a functions, its not supposed to be, i want to have it check the letters of arr[1] with arr [0], and i even converted every thing back into strings.

Your code so far


function mutation(arr) {
let b = /\w/gi
let x = arr[1].match(b);
x.toString();
let r = arr[0].match(b)
r.toString();
let y = "rrr"
let d = r.search(x)
console.log(d)
return 
}


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36.

Challenge: Mutations

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

There is no search() method on arrays. I think you want find().

As @bbsmooth points out, there is no such method named search. What exactly were you trying to accomplish with this line of code?