Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Car(color) {
- this.color = color
- this.automatic = false;
- this.satnav = false;
- this.radio = true;
- this.mot = null;
- }
- Car.prototype = {
- addFuel: () => {
- console.log('just added fuel to your car')
- },
- washCar: () => {
- console.log('your car just got washed')
- }
- }
- const BMW = new Car('red');
- BMW.addFuel(); // Just added fuel to your car
- console.log(BMW.color) // red
- console.log(BMW.satnav) // false
- BMW.satnav = true;
- console.log(BMW.satnav) // true
Add Comment
Please, Sign In to add comment