Skip to content

Tag: trie

How to implement a ‘contains’ search in JavaScript

I’m creating a search box that allows you to search for different companies. I’d like the search box to perform a ‘contains’ search. For example, let’s say that I want to look up the company ExxonMobil Oil Corp. Typing in any of the following should include the company in the list of results (this isn’t exhaustive): oil corp oil corp