ES6 Classes & Constructors
What design pattern does the clone method implement?
class User {
constructor(id, name) {
Object.assign(this, {id, name});
}
clone() {
return Object.assign(Object.create(Object.getPrototypeOf(this)), this);
}
}