Put in order · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects

Prototype Chain - Search Order

Arrange the steps of searching for a property in the prototype chain:

Items to put in order

  • Check the object's prototype (Object.getPrototypeOf)
  • Return undefined (end of chain - null)
  • Check the object itself
  • Check the prototype's prototype (chain)
Show the answer

Correct order:

  1. Check the object itself
  2. Check the object's prototype (Object.getPrototypeOf)
  3. Check the prototype's prototype (chain)
  4. Return undefined (end of chain - null)