Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Car(brand, horsepower, price) {
- return {
- brand,
- horsepower,
- price,
- fuel: 75,
- get reduceFuel() {
- return this.fuel;
- },
- set reduceFuel(liters) {
- this.fuel -= liters;
- },
- }
- }
- let myCar = Car('Audi', 313, '37000$');
- myCar.reduceFuel = 10;
- console.log(myCar.reduceFuel);
Advertisement
Add Comment
Please, Sign In to add comment