In trying to better understand the prototype behind javascript, I have stumbled upon the following, which I am unable to make sense of so far.
I understand that functions are a first class object, but I don’t get why Object gets this property after setting the property on Function.prototype
Function.prototype.foo = 'bar';
Object.foo // Object now has this property and returns 'bar'
Object.foo === Function.prototype.foo // returns true
Objectis a function,typeof Object == 'function'is true. So you assign a property ofFunction.prototype, it will let theObjecthas the property also. (in the property chain.)