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

Time:09-28

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?

CodePudding user response:

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

  • Related