This commit is contained in:
37
06_js-debug/uebungen/u07_check-temperature/index.html
Normal file
37
06_js-debug/uebungen/u07_check-temperature/index.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!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;
|
||||
const message;
|
||||
|
||||
if (temperature > threshold) {
|
||||
message = "It's too hot outside!";
|
||||
} else {
|
||||
message = "The temperature is just right.";
|
||||
}
|
||||
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
checkTemperature(25); // => "The temperature is just right."
|
||||
checkTemperature(35); // => "It's too hot outside!"
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user