Algorithms and Data Structures · Junior · Question 66 of 75

What is the complexity of looking up a key in a plain JavaScript object, obj[key]?

Explanation

Engines store object properties in hash-table-like structures (or hidden classes for stable shapes), so access is constant time on average, just like Map.

Further reading

Problem with a question

Algorithms and Data Structures · Junior · question 66

Test yourself

Take the Algorithms and Data Structures · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz