cade galt 0 cade galt 0 - 7 months ago 36
Javascript Question

What is the difference between __proto__ and prototype?

I'm trying to extend my library to include inheritance, but I don't understand the difference between

__proto__


and

prototype


in the context of objects, functions, and instances. ( the dup does not cover objects )
I played around with the and found some interesting behaviors:

enter image description here

Answer

One thing the marked duplicate does not mention, is that functions implicitly have a prototype property, while object literals do not.

And to re-iterate prototype is not implicitly available on the instances themselves, but on __proto__ is.