Skip to content

Instantly share code, notes, and snippets.

@Melkanea
Created December 18, 2019 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Melkanea/66fe13e2e10618bbff2adb835b275975 to your computer and use it in GitHub Desktop.
Save Melkanea/66fe13e2e10618bbff2adb835b275975 to your computer and use it in GitHub Desktop.
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