Eventuali duplicati:
What it the significance of the Javascript constructor property?Quando è necessario impostare la proprietà 'prototype.constructor' di una classe in Javascript?
Nel Javascript docs a developer.mozilla.org, sul tema della eredità c'è un esempio
// inherit Person
Student.prototype = new Person();
// correct the constructor pointer because it points to Person
Student.prototype.constructor = Student;
mi chiedo perché dovrebbe Aggiorno la proprietà del costruttore del prototipo qui?
'var st2 = st.constructor();' manca la parola chiave 'new'. Dovrebbe essere 'var st2 = new st.constructor();' – golem