The element is array is accessed by index, which is a number. The element in hash map (hash table) is accessed by key. Since key can be any data type, i.e. number, string or object, hash map is more versatile. Now hash map is replacing array to be the underneath data structures for adjacency list in graph and children in trie.