⛄ Snowberb ⛄ – 15-39 Jun 25
I do not know how to search this question in google, so I'll write it here. I want to create an array of objects like this:
key
being a uuid
that I will randomly generate, and all that data comes from another array of objects which is like this:
const savedBets = [{}, {}, {}...]
I've heard of Hash maps
but I never used one. Is that the best way to transform savedBets
into the structure that I want?9 Replies
I need to have an array of
key: value
because I have to create/delete entriesYou can delete entries from objects/Map too, what's the problem with them?
There's no problem
I just don't know what to use
I'd probably recommend Map, good for key-value storage, and easily iterable too
Map is more performant than Object for creation and deletion right?
It's generally better than object but in reality it could be a liiitle bit worse than object too
why worse?
Could be few nanoseconds faster if working with just a few entries, but in general Map is a lot better than object in all the aspects
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/990280118528262215