Learn JavaScript

Lesson 5 of 9 ¡ this, Prototypes and Classes

Module 9 ¡ this, Prototypes and Classes

Under the Hood: the Chain Walked by Hand, instanceof, and How V8 Sees Class Objects

ProReading

Lesson 01 drew the prototype chain as boxes and arrows. That picture is right, but it leaves out three things a working programmer meets sooner or later. A getter found far up the chain still sees the object you started from. instanceof can be told to lie. And the speed of a lookup depends less on how far it climbs than on how much variety one line of code sees.

Checking what this lesson needs for youâ€Ļ

What is inside Under the Hood: the Chain Walked by Hand, instanceof, and How V8 Sees Class Objects

  1. What the specification says a lookup is
  2. The chain walked by hand
  3. What instanceof really checks
  4. When Symbol.hasInstance changes the answer
  5. What a lookup up the chain costs
  6. How V8 treats class objects
  7. Changing a prototype later