__proto__ VS prototype in JavaScript

Abhay Jain
Jan 3, 2021

--

__proto__ is the actual object that is used in the lookup chain to resolve methods, etc. prototype is the object that is used to build __proto__ when you create an object with new .

Decoding with an Example:

var b = new Foo(20);
var c = new Foo(30);

This figure again shows that every object has a prototype. Constructor function Foo also has its own __proto__ which is Function.prototype, and which in turn also references via its __proto__ property again to the Object.prototype. Thus, repeat, Foo.prototype is just an explicit property of Foo which refers to the prototype of b and c objects.

--

--

Abhay Jain

Developer with 3 yrs of industrial experience in developing scalable web applications.