Prefix-Trie
Simple Prefix-Trie in JavaScript
This Prefix-Trie allows us to:
-
Sort words by Alphabetical order using Prefix Tree and search to see if word is in the array
-
Search for specifc word in the array as an exact match
-
Get array to filter down as we KeyUp each letter of the chosen search term.
-
Limit array to maximum 3 closest matches - ie the first three as we are filtering alphabetically now.
How to test:
Use the terminal and type node test.js to run the file and check console.log outputs.