cade galt 0 cade galt 0 - 2 years ago 154
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




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 Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download