Can anybody explain/elaborate on the following:
I have checked this on console.
Function.prototype and Function.__proto__ point to the same object. It is also the same object that is referenced by Object.__proto__.
Any custom function that you write or even the built-ins one (Array,String,Number) , have their .__proto__ point to this object.
Checking Function.prototype on console returns:
ƒ () { [native code] }
Interestingly, this object's .__proto__ point to Object.prototype object.
I do understand that Object.prototype.__proto__ is null which is where the prototype chain stops.
Found the image here
Function()andObject()) inherits fromFunction.prototype, which holds function methods like.call/.apply/.bind, and in turn inherits fromObject.prototype.console.dirto print it as an object -Function.prototypeis a function for some reason. And no,Function.prototype === Obect.getPrototypeOf(Function)isn't strange if you consider what they mean, but it's special indeed as this only happens on a "metaclass" where the class is an instance of itself.Function.prototyperemains aFunctionobject is due to backwards compatibility. Basically, there is a change in ES specification regarding how should a prototype object of an object be treated. For eg, in ES5,String.prototypeis anStringobject but in ES6, its an object of typeObject. The exception to such changes are "prototype objects" ofFunctionandArray. You can read more here: stackoverflow.com/questions/32928810/…