Kris
Kris

Reputation: 124

Efficient way to find value from an object with over 10,000 key/value pairs

I have a big object with over 10,000 key-value pairs.

I want to find the value of a specific pair so I do this:

const value = object[key]

Is this efficient? Is there a better way to do this? is it OK to have an object with < 10,000 entries?

Upvotes: 3

Views: 651

Answers (1)

Denis_LT
Denis_LT

Reputation: 138

Javascript objects are implemented as hashmaps, so the complexity of retrieving a value should be O(1), it should be efficient.

Upvotes: 7

Related Questions