I have an array element that I wish to see if it matches the contents of an array element from a different array in JavaScript. I wish to create a pattern variable like \element 1\, where element 1 is from the first array. I could then say something like pattern.test(element 2), where element 2 is from array 2. Element 1, however, is a variable, and I want to use its contents when building the pattern variable. Can you help?
Tags: