In JavaScript, when I define a new function
function Foo () { /* code */ }
The prototype of this function is set to a new object and that object's constructor
is set to the newly created function itself, so
Foo.prototype.constructor === Foo
This behaviour is well-described both in the ECMAScript spec and also on a more human-friendly MDN.
Is this property used in any other way than being just a friendly shortcut to get to the constructor function?
For example, if I were to
delete Object.prototype.constructor
(which I can, because, at least in Node.js, the property is defined as writable and configurable), am I somehow affecting the language's functionality?
After some rudimentary tests it does not seem to affect defining creating new objects as the property is defined properly for each new function / object I create.
Note: I am aware that this could break 3rd party code - I am only interested in the core language's functionality.