DEV Community

Discussion on: JavaScript Inheritance: The Dark Arts

Collapse
 
nickkelly314 profile image
Nick Kelly • Edited

The confusing part is this:

instance.constructor.prototype === Object.getPrototypeOf(instance); // false
Enter fullscreen mode Exit fullscreen mode

Which makes sense once you know that instance.constructor is accessing an altered constuctor property from the prototype, but otherwise might be quite confusing.

You're right that it probably doesn't belong with the other examples. Hopefully JavaScript developers unaware of prototype.constructor might find it interesting.