R
Reactiflux

⛄ Snowberb ⛄ – 15-39 Jun 25

⛄ Snowberb ⛄ – 15-39 Jun 25

S⛄Snowberb⛄6/25/2022
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? I need to have an array of key: value because I have to create/delete entries
EEva6/25/2022
You can delete entries from objects/Map too, what's the problem with them?
S⛄Snowberb⛄6/25/2022
There's no problem I just don't know what to use
EEva6/25/2022
I'd probably recommend Map, good for key-value storage, and easily iterable too
S⛄Snowberb⛄6/25/2022
Map is more performant than Object for creation and deletion right?
EEva6/25/2022
It's generally better than object but in reality it could be a liiitle bit worse than object too
S⛄Snowberb⛄6/25/2022
why worse?
EEva6/25/2022
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
UUUnknown User6/26/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

⛄ Snowberb ⛄ – 15-39 Jun 25

Join Server