I am searching through large set of an array with length more than 10000.
sample array should look like this.
let data = ['Hello world mr tom', ........]; // array length of 10000 with different strings let input = '' // string gets from input field and this is my code.
this.results = []; for (let i = 0; i < data.length; i++) { if (input.toLowerCase().split(' ').every(val => data[i].toLowerCase().includes(val))) { this.results.push(data[i]) } } it is working, but it is taking too much time to load. let's say in my array list i have a common string called Hello world when entering this string in the input field, it is taking too much time to load. Is there any optimized way to acheive this search with lesser amount of time.