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?

Answer

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



Source: stackoverflow