Racing Game Example
let car = {
brand: "Ferrari",
model: "458 Italia",
horsepower: 562,
weight: 1395,
topSpeed: 202,
accelerate: function() {
console.log("The car is accelerating.");
},
brake: function() {
console.log("The car is braking.");
}
};let raceEvent = {
name: "Formula 1 Grand Prix",
location: "Monaco",
laps: 78,
start: function() {
console.log("The race has started!");
},
finish: function() {
console.log("The race has finished!");
},
leaderboard: [
{ car: car1, lapsCompleted: 78, time: "1:45:27.098" },
{ car: car2, lapsCompleted: 78, time: "1:45:30.143" },
{ car: car3, lapsCompleted: 78, time: "1:45:34.298" }
]
};Last updated