How to quickly find names from a list in the text in React Native?

Hello, please help with the question.

For example, there are 4 different names in the array: var array = [‘Leo’, ‘Ivan’, ‘Mari’, ‘Anna’];

And in the variable text, the text in which you can check which of the names are.

In JavaScript, you can check in a loop with the indexOf () function, but how in React Native can you make it so that only those names that are in text are displayed?

In addition, the search function should work quickly, such a task was set, but indexOf () is fast, isn’t it?) It would be good to check all 4 names in one “query”

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