how to get Matching string present in array in javacsript

I have an array -

const a = ['first','test','second','test1','test2,'test3','last','now',get']

I have test,test1,test2,test3. I want to get index of test3 using test then dynamic number. How can I do this ?

First we have to check if test is present in array then get indexOf test otherwise get index of test1,test2,test3,test4 dynamically. We don't know what will be the dynamic number in test keyword. But yes dynamic number would be consecutive like 1,2,3,4 or 3,4,5,6

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum