
Untitled
Guest 28 18th Feb, 2025
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Oferta Samochodu</title>
</head>
<body>
<h2>Oferta Samochodu</h2>
<p id="oferta"></p>
<script>
// Definicja obiektu Oferta
let Oferta = {
marka: "Kia",
model: "Carens",
cena: 60000,
spalanie: 8, // litry na 100 km
pb95: 6, // cena paliwa w zł/litr
// Metoda obliczająca koszt 100 km
koszt100km: function () {
return this.spalanie * this.pb95;
}
};
// Wyświetlenie informacji na stronie
document.getElementById("oferta").innerHTML =
`Marka: ${Oferta.marka}, Model: ${Oferta.model}, Koszt 100 km: ${Oferta.koszt100km()} zł`;
</script>
</body>
</html>
To share this paste please copy this url and send to your friends
RAW Paste Data