Skip to content
Advertisement

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?

Advertisement

Answer

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

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement