Other data structures exists?

alphacyberranger@sh.itjust.works to Programmer Humor@programming.dev – 194 points –
5

Javascript devs be like...

It isn't just JavaScript (or Java which uses the "Hashmap" name).

There are, of course, languages that don't have an equivalent structure, but for those that are sufficiently popular, it's almost certain that someone has written a library that emulates associative arrays and then fairly certain that that library, in turn, has been used in production somewhere.

File this under "If it's stupid but it works..."

I'm just poking fun that the fundamental type in JS (Object) is an associative-array/hashmap. Technically it has some fancy under-the-hood handling for pure arrays and primitive types. This is also exactly true of Lua, and a little true of Ruby and Python.

Really, most programmers would do great to start with a hash map or array list and only specialize out further when the problem calls for it.

Hashmaps are just arrays with notions. Sets are just hashmaps with doormen.