I am in need of a Javascript data structure which will allow me to insert strings and search for strings efficiently. I have been looking around and the only data structures I have come across are objects and arrays. Objects are more used for encapsulation and cannot really be used for searching and using arrays can be slow. Are there any other data structures that will allow me to insert and search strings efficiently? Right now at best I could do a binary search on an array. Any other ideas? Thanks.
Share
That was true in classical languages, not so true in JS.
Objects can be searched in JS. Bear with me…
Yes, can be – but don’t have to be.
Data structures? No. Again that is a classical perspective. In JS, it is different.
Check out _underscore.js.
This is a good example of JS flexibility.
Hope that helps.
All the best!
Nash