40 lines
1.2 KiB
HTML
40 lines
1.2 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 7: checkTemperature Fehler</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">
|
|
<h1>Übung 7: checkTemperature Fehler</h1>
|
|
<p>Versuche, den Code auszuführen, den Fehler zu identifizieren und ihn zu beheben.</p>
|
|
</div>
|
|
</main>
|
|
<script>
|
|
'use strict';
|
|
|
|
function checkTemperature(temperature) {
|
|
const threshold = 30;
|
|
|
|
// let message = '';
|
|
|
|
// if (temperature > threshold) {
|
|
// message = "It's too hot outside!";
|
|
// } else {
|
|
// message = 'The temperature is just right.';
|
|
// }
|
|
|
|
const message = temperature > threshold ? "It's too hot outside!" : 'The temperature is just right.';
|
|
return message;
|
|
// console.log(message);
|
|
}
|
|
|
|
console.log(checkTemperature(25)); // => "The temperature is just right."
|
|
console.log(checkTemperature(35)); // => "It's too hot outside!"
|
|
</script>
|
|
</body>
|
|
</html>
|