I am trying to understand the JavaScript prototype and I am bit confused.There are tons of tutorials out there and each has different explanation on it. So I don't know where to start with.
So far I have created a simple JavaScript object
var a = {flag : 1}
In MDN, I read that
All objects in JavaScript are descended from Object
But I couldn't find the prototype for this object a a.prototype gives me undefined
Then I found the prototype is available in a.constructor.prototype. When I create a function var myfunc = function() {} and then myfunc.prototype is available. So the prototype property is directly available on functions and not on objects.
Please help me to understand this and what is that a.constructor.
Any help is greatly appreciated.