Closed Bug 1286628 Opened 8 years ago Closed 6 years ago

Object.prototype.constructor is not a reference to the constructor of the prototype

Categories

(Developer Documentation Graveyard :: JavaScript, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jonathan.bouzekri, Unassigned)

References

()

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 Steps to reproduce: I am wondering if there is a bug in the JS documentation about Object.prototype.constructor : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor It says "Returns a reference to the Object function that created the instance's prototype.". But to me It should be : "Returns a reference to the Object function that created the instance". If you create a function constructor : function User(name) { this.name = name } and an instance of this class : var u = new User('toto'); Actual results: Indeed, the property constructor is available in the prototype and point to the function constructor User. However the prototype is an instance of Object as we did not set a custom prototype in our function constructor. To me it is not the function which has created the prototype. It is the function which has create the instance stored in the variable "u". Expected results: The documentation should be changed to "Returns a reference to the Object function that created the instance". I just want to know if it is okay if I make this change in the documentation as I am not sure it is the right thing to do.
This appears to be fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.