Property Accessor didalam Object Class Javascript

Property Accessor didalam Object Class Javascript

Melalui objek class kita juga bisa merubah nilai properti semacam ini: class Car {  constructor(manufacture, color) {  this.manufacture = manufacture;  this.color = color; this.enginesActive = false;     } } const johnCar = new Car(“Honda”, “Red”); console.log(`Warna mobil: ${johnCar.color}`);  // output -> Warna Mobil: Red johnCar.color = “White”;  // Merubah nilai properti color jadi white console.log(`Warna mobil: ${johnCar.color}`); // output -> Warna […]