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:
- Check the object itself
- Check the object's prototype (Object.getPrototypeOf)
- Check the prototype's prototype (chain)
- Return undefined (end of chain - null)