OOP Javascript Basics - Prototype Inheritance

Hi. The way I understand Inheritance in JS, eg Prototypical Inheritance, is that basically every object I create will inherit from its ancestor Object Base or Prototype. But will all objects derive from this Unique Proto?

Console example:

o1 = {}
{}
__proto__: Object

o2 = {}
{}
__proto__: Object

Object is the prototype for both o1 and o2?
Can I check that via code?

Sure – an equality check only evaluates to true if both objects are strictly identical:

console.log(
  o1.__proto__ === o2.__proto__
)
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.