Files
JS/01_grundlagen/uebungen/u16_rest-sekunden-2.html
T
2026-09-11 11:25:27 +02:00

32 lines
1.0 KiB
HTML

<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Übung 16: Sekunden, Teil 2</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<main>
<div class="container py-5">
<div class="alert alert-primary">
<h2>Übung 16: Sekunden, Teil 2</h2>
Gib die Ergebnisse des Zeitrechners (Übung 3) abgerundet (ohne Nachkommastellen) in folgender Form aus:
<strong>mm:ss</strong>
</div>
<div class="output alert alert-secondary"></div>
</div>
</main>
<script>
'use strict';
const outputEl = document.querySelector('.output');
const minutes = Math.floor(2000 / 60); // => 33 Minuten
const seconds = 2000 % 60; // => 20 Restsekunden
outputEl.textContent = `${minutes}:${seconds} (mm:ss)`;
</script>
</body>
</html>