exercises/w11-patterns/w8_factory/index.js
2025-05-06 14:20:09 +09:00

27 lines
511 B
JavaScript

class Computer {
constructor(brand, os, ram, cpu, ssdSize) {
this.brand = brand;
this.os = os;
this.ram = ram;
this.cpu = cpu;
this.ssd = ssdSize;
}
showSpects() {
console.log(
`Brand is ${this.brand} with ${this.os} OS.
CPU: ${this.cpu} / RAM: ${this.ram} / SSD size: ${this.ssd}
`
);
}
}
// 1. Create a Builder for this
class ComputerBuilder {}
// 2. Create a factory
// 3. Change it using a singleton
class ComputerFactory {}
console.log('ready');