⛄ 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:
const bets = ["key": {object}, "key": {object}, "key": {object}]
const bets = ["key": {object}, "key": {object}, "key": {object}]
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?
S
Sniberb663d ago
I need to have an array of key: value because I have to create/delete entries
E
Eva663d ago
You can delete entries from objects/Map too, what's the problem with them?
S
Sniberb663d ago
There's no problem I just don't know what to use
E
Eva663d ago
I'd probably recommend Map, good for key-value storage, and easily iterable too
S
Sniberb663d ago
Map is more performant than Object for creation and deletion right?
E
Eva663d ago
It's generally better than object but in reality it could be a liiitle bit worse than object too
S
Sniberb663d ago
why worse?
E
Eva663d ago
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
UU
Unknown User663d ago