I'm trying to get behind javascript internals and prototyping at the moment. One thing that's tripping me up at the moment is that when I assign Object.prototype to something, it doesn't seem to actually do anything, as opposed to when I do the same for functions I define (Likewise for other builtins like Function.prototype). So I get some unexpected results when I run the following in my browser:
function A() {};
typeof A // "function"
console.log(A.prototype); // {constructor: ƒ} etc
A.prototype = null
console.log(A.prototype); // null
typeof Object // "function"
Object.prototype // {constructor: ƒ} etc
Object.prototype = null
Object.prototype // still {constructor: ƒ} etc, not null
Why is that? Is it simply by definition, so Object.prototype is always the same no matter what? And if so, does my assignment of Object.prototype actually do anything?
And, perhaps this is a subjective question, but if so, why doesn't this throw an error then?