Inheritance
__proto__: Every object in JavaScript will have a property called __proto__, which will always point to the parent object. So in the above example, object obj.__proto__ is pointing to the info.constructor.
Prototype: Every function in JavaScript will contain some constructor properties. Further constructor properties will also have prototype properties. This prototype property is the basis of inheritance, and hence the inheritance in JavaScript is referred to as prototypal inheritance. CoQsLGHr WhLs fiJurH Ds DQ HxDPSOH. ,Q WhH FoGH showQ LQ ILJurH 1, osfy is the object in which __proto__ of osfy is pointing to the prototype of articleInfo. All the constructor properties as well as prototype properties of the articleInfo are now inherited by the osfy. Check out the last line, osfy.__proto__. It clearly shows that it has got all the properties of articleInfo and is pointing to the same object, including its constructor and prototype properties.
A graphical representation of the above example is shown in Figure 2. )roP WhH DEoYH HxDPSOH LW Ls FOHDr WhDW WhH flow Ls: Object Properties->Parent Object->Constructor Properties->Prototype Properties->.....->null
These are the basics of JavaScript’s object- oriented nature, which might have come as a surprise to you. According to me, JavaScript is the most misunderstood language in the computing world. A few months ago, I was using JavaScript just for DOM manipulation but after getting an in- depth knowledge of it, I am in love with it. I can say that JavaScript is a real programming language. So just give it a try and you will come to know about the good parts of JavaScript. Queries and suggestions are always welcome.