This commit is contained in:
Philippe Torrel
2026-06-17 12:09:33 +02:00
parent 31dbf03808
commit 3c618cf1e0

View 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>Konstante als Konfigurationsvariable (const)</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>Konstante als Konfigurationsvariable (const)</h1>
<div class="output alert alert-secondary my-3"></div>
</div>
</main>
<script>
'use strict';
// Konfigurationsvariable - SCREAMING_SNAKE_CASE - Schreibweise
const TAX_RATE = 1.19;
// const BASE_URL = 'http://localhost:8080';
// const DEBUG_MODE = false;
const outputEl = document.querySelector('.output');
const netPrice = prompt('Net price for the shocking pen?');
// let totalPrice = netPrice * 1.19; // Vermeidung von "Magic Values" - Werte, die nur aus dem Kontext verstanden werden, sollen vermieden werden.
const totalPrice = netPrice * TAX_RATE;
const resultText = `total price: ${totalPrice}`;
console.log(resultText);
outputEl.textContent = resultText;
</script>
</body>
</html>