Created
December 18, 2019 09:15
-
-
Save Melkanea/66fe13e2e10618bbff2adb835b275975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toyota = | |
{ | |
make: "Toyota", | |
model: "Corolla", | |
year: 2015, | |
color: "white", | |
passengers: 5, | |
convertibe: false, | |
mileage: 58000, | |
started: false, | |
fuel: 0, | |
start: function() | |
{ | |
this.started = true; | |
}, | |
stop: function() | |
{ | |
this.started = false; | |
}, | |
drive: function() | |
{ | |
if (this.started) | |
{ | |
alert("Brooom Brooom"); | |
} | |
else | |
{ | |
alert("you need to start the engine first!"); | |
} | |
}, | |
addFuel: function () | |
{ | |
this.fuel = prompt("Add fuel to the car", ); | |
}, | |
checkFuel: function () | |
{ | |
if (this.fuel === 0) | |
{ | |
alert("You need to add fuel!"); | |
} | |
} | |
}; | |
toyota.checkFuel(); | |
toyota.addFuel(); | |
toyota.start(); | |
toyota.drive(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment