классы JavaScript
class Car {
constructor(name, year) {
this.name = name;
this.year = year;
}
carDetails() {
console.log("Car name: " + this.name, "\nCar year: "+ this.year);
}
drive() {
console.log("Driving!")
}
}
let car = new Car("Audi", 2019);
car.carDetails();
car.drive();
The Cat Coder