I have the following array
data = [
{message:'hello there my name is'},
{message:'this is a test'}
]
I am trying to find an index of this array given a variable like such
const toFind = 'hello there'
Thus the expected return would be an index of [0]
.
I was looking for something with the effect of IndexOf()
or includes()
, but I am not sure how to incorporate this into looping the array and finding a substring of the text.