I have the following parent class...
function Parent(id, name, parameters) {
Object.defineProperty(this, "id", {
value: id
});
Object.defineProperty(this, "name", {
value: name,
writable: true
});
};
and the corresponding child class:
function Child(id, name, parameters) {
Object.defineProperty(this, "phone", {
value: parameters.phone,
writable: true
});
};
I tried to apply inheritance by adding something like Child.prototype = Object.create(Parent.prototype); , but this obviously does not work.
How can I inherit from the Parent class such that I can use the properties id and name.