JS: Get/Set Prototype

By Xah Lee. Date: . Last updated: .

Get Parent

You can use the following to get a object's parent:

Best to use Reflect.getPrototypeOf.

Set Parent

Note: when you change a object X's parent, all X's children will be effected for property lookup, due to the prototype chain.

Check is in Prototype Chain


[see JS: Object.prototype.isPrototypeOf]

Show Prototype Chain

JS: Show Prototype Chain

JS Object and Inheritance

  1. Object Overview
  2. Object Type
  3. Find Object's Type
  4. Prototype Chain
  5. Create Object
  6. Object Literal Expr
  7. Create Object with Parent X
  8. Get/Set Parent
  9. Show Prototype Chain
  10. Prevent Adding Property
  11. Clone Object
  12. Test Object Equality
  13. Add Method to Prototype

Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials