I'm seeking assistance with this code snippet I have written:
const parqueAutomotor = [];
parqueAutomotor[0] = {Brand: "Peugeot",
Model: "206",
Doors: 4,
Price: "$200.000,00"},
parqueAutomotor[1] = {Brand: "Honda",
Model: "Titan",
Displacement: "125c",
Price: "$60.000,00"},
parqueAutomotor[2] = {Brand: "Peugeot",
Model: "208",
Doors: 5,
Price: "$250.000,00"},
parqueAutomotor[3] = {Brand: "Yamaha",
Model: "YBR",
Displacement: "160c",
Price: "$80.500,50"
};
var i, item;
for (i = 0; i < parqueAutomotor.length; i++) {
for (item in parqueAutomotor[i]) {
console.log(item + ": " + parqueAutomotor[i][item] + " // ");
}
}
The expected output in the console is:
Brand: Peugeot // Model: 206 // Doors: 4 // Price: $200.000,00
Brand: Honda // Model: Titan // Displacement: 125c // Price: $60.000,00
Brand: Peugeot // Model: 208 // Doors: 5 // Price: $250.000,00
Brand: Yamaha // Model: YBR // Displacement: 160c // Price: $80.500,50
However, the actual output I am receiving is not formatted correctly as requested.
Can anyone suggest how to resolve this issue while maintaining the specified format? Thank you!