Learn JavaScript

Lesson 5 of 9 · Objects, Destructuring, Spread and JSON

Module 8 · Objects, Destructuring, Spread and JSON

Under the Hood: Property Order, Hidden Classes, Inline Caches and the Cost of delete

ProReading

Maria asks "but why" more than anyone in the class. In Lesson 01 she saw that a changed key keeps its place, and that keys which look like numbers jump to the front. She wants the rule written down, not a list of surprises. She has also heard that "objects are just hash tables", and that delete is slow. She wants to see both claims tested.

Checking what this lesson needs for you…

What is inside Under the Hood: Property Order, Hidden Classes, Inline Caches and the Cost of delete

  1. What the specification says a property is
  2. The order of keys: OrdinaryOwnPropertyKeys
  3. Hidden classes: what V8 calls maps
  4. Inline caches
  5. The cost of delete
  6. Objects as dictionaries, from the inside