if I have a large javascript string array that has over 10,000 elements,
how do I quickly search through it?
Right now I have a javascript string array that stores the description of a job,
and Im allowing the user to dynamic filter the returned list as they type into an input box.
So say I have an string array like so:
var descArr = {flipping burgers, pumping gas, delivering mail};
and the user wants to search for: p
How would I be able to search a string array that has 10000+ descriptions in it quickly?
Obviously I can't sort the description array since they're descriptions, so binary search is out. And since the user can search by p
or pi
or any combination of letters, this partial search means that I can't use associative arrays (i.e. searchDescArray[pumping gas]
)
to speed up the search.
Any ideas anyone?