class Computer { constructor() { this.board = this.processor = this.ram = this.diskDrive = this.videoCard = "Sin Definir"; } } class ComputerBuilder { constructor(computer = new Computer()) { this.computer = computer; } computerScreen(computerScreen) { this.computer.computerScreen = computerScreen; return this; } peripherals(peripherals) { this.computer.peripherals = peripherals; return this; } board(board) { this.computer.board = board; return this; } processor(processor) { this.computer.processor = processor; return this; } ram(ram) { this.computer.ram = ram; return this; } diskDrive(diskDrive) { this.computer.diskDrive = diskDrive; return this; } videoCard(videoCard) { this.computer.videoCard = videoCard; return this; } build() { return this.computer; } } let computerBuilder = new ComputerBuilder(); let computer = computerBuilder .board("Gigabyte Aorus z390 elite") .processor("INTEL CORE I9 9900K 8/16 3.6GHZ 5.0GHZ 16MB") .ram("Hyperx 32GB 3200MHz hyperx fury") .diskDrive("SSD Kingston a400 480GB") .videoCard("MSI Nvidia geforce RTX 2070 super ventus 8GB") .peripherals("Mouse y Teclado RAZER") .computerScreen("27' ASUS DESIGNO Ref:MZ27AQL Res:2560X1440 IPS") .build(); console.log(computer); /* Computer { board: 'Gigabyte Aorus z390 elite', processor: 'INTEL CORE I9 9900K 8/16 3.6GHZ 5.0GHZ 16MB', ram: 'Hyperx 32GB 3200MHz hyperx fury', diskDrive: 'SSD Kingston a400 480GB', videoCard: 'MSI Nvidia geforce RTX 2070 super ventus 8GB', peripherals: 'Mouse y Teclado RAZER', computerScreen: "27' ASUS DESIGNO Ref:MZ27AQL Res:2560X1440 IPS" } */