Object Creation Methods
What creation pattern allows object cloning?
const proto = {
init(config) {
Object.assign(this, config);
return this;
},
clone() {
return Object.create(Object.getPrototypeOf(this)).init({...this});
}
};
const proto = {
init(config) {
Object.assign(this, config);
return this;
},
clone() {
return Object.create(Object.getPrototypeOf(this)).init({...this});
}
};