This commit is contained in:
Philippe Torrel
2026-06-18 10:46:31 +02:00
parent 86e9bcea64
commit a1b0051a0b
8 changed files with 175 additions and 94 deletions

View File

@@ -1,49 +0,0 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Übung 13: Fehler im Detail</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 my-3">
<h2>Übung 13: Fehler im Detail</h2>
<p>Im folgenden Code haben sich einige Fehler und auch Regelwidrigkeiten eingeschlichen.</p>
</div>
<div class="output alert alert-secondary my-3"></div>
</div>
</main>
<script>
'use strict';
const outputEl = document.querySelector('.output');
// let TALE = `Three hicks were working on a telephone tower - Steve, Bruce and Jed. Steve falls off and is killed instantly.
// As the ambulance takes the body away, Bruce says, 'Someone should go and tell his wife.'
// Jed says, 'OK, I'm pretty good at that sensitive stuff, I'll do it.'
// Two hours later, he comes back carrying a case of beer.
// Bruce says, 'Where did you get that, Jed?'
// 'Steve's wife gave it to me,' Jed replies.
// 'That's unbelievable, you told the lady her husband was dead and she gave you beer?'
// Well, not exactly', Jed says. 'When she answered the door, I said to her, "You must be Steve's widow".'
// She said, 'No, I'm not a widow!'
// And I said, 'I'll bet you a case of Budweiser you are.`;
//Console.log(tale);
</script>
</body>
</html>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -23,6 +23,11 @@
'use strict';
const outputEl = document.querySelector('.output');
const age = prompt('Wie alt sind Sie?');
console.log(age);
outputEl.textContent = `Du bist ${age} Jahre alt.`;
</script>
</body>
</html>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -34,9 +34,18 @@
<script>
'use strict';
const TAX_PERCENTAGE = 22;
const TAX_RATE = 1 + TAX_PERCENTAGE / 100; // => 1.22
const outputEl = document.querySelector('.output');
const price = 150;
// const totalPrice = price + (price * TAX_PERCENTAGE) / 100;
const totalPrice = price * TAX_RATE;
console.log(totalPrice);
outputEl.textContent = `total price is: $${totalPrice}`;
/* your code here */
</script>
</body>

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -21,32 +21,32 @@
<tbody>
<tr>
<td>Preis eines Buches in einem Onlineshop</td>
<td>-</td>
<td><strong>bookPrice</strong>, buchPreis</td>
</tr>
<tr>
<td>Anzahl der angemeldeten Benutzer</td>
<td>-</td>
<td>userNr, <strong>userAmount</strong>, loggedUserCount, angemeldeteBenutzer</td>
</tr>
<tr>
<td>Titel einer Webseite</td>
<td>-</td>
<td><strong>siteTitle, pageTitle, websiteTitle</strong></td>
</tr>
<tr>
<td>Höhe eines Hauses auf einer Immobiliensite</td>
<td>-</td>
<td>hausHoehe, <strong>houseHeight</strong>, buildingHeight, heightOfHouse</td>
</tr>
<tr>
<td>Typ eines Monitors auf der Site eines Herstellers</td>
<td>-</td>
<td>monitorTyp, <strong>screenType</strong>, monitorType, displayType</td>
</tr>
<tr>
<td>Fahrgestellnummer eines reparierten Autos auf der Website einer Autowerkstatt</td>
<td>-</td>
<td>reapariertFahrgestellNr, <strong>vinRepaired</strong></td>
</tr>
</tbody>
</table>

View File

@@ -24,123 +24,123 @@
<td>bildNr</td>
<td>Inhalt</td>
<td>-</td>
<td>-</td>
<td>imageNr, imageNumber</td>
</tr>
<tr>
<td>bildid</td>
<td>Inhalt</td>
<td>-</td>
<td>-</td>
<td>kein lowerCamelCase</td>
<td>bildId, imgId, imageId</td>
</tr>
<tr>
<td>bildZähler</td>
<td>Anzahl der hochgeladenen Bilder</td>
<td>-</td>
<td>-</td>
<td>keine Sonderzeichen</td>
<td>bildZaehler, imageCounter, imgCounter</td>
</tr>
<tr>
<td>zahlerFuerDie AktuelleZeileIn DerTabelleDie DieBenutzer Auflistet</td>
<td>Zähler für die aktuelle Zeile, in der Tabelle, die die Benutzer auflistet.</td>
<td>-</td>
<td>-</td>
<td>zu lang</td>
<td>aktuelleZeileInBenutzerliste, userCountCurrentRow</td>
</tr>
<tr>
<td>urenKelvornAme</td>
<td>Vorname des Sohns eines Enkels</td>
<td>-</td>
<td>-</td>
<td>falsche Groß- und Kleinschreibweise</td>
<td>urenkelVorname, greatGrandsonFirstName, firstNameGreatGrandson</td>
</tr>
<tr>
<td>x</td>
<td>Geburtsdatum</td>
<td>-</td>
<td>-</td>
<td>nicht aussagekräftig</td>
<td>gebDatum, <strong>birthdate</strong>, dateOfBirth</td>
</tr>
<tr>
<td>y</td>
<td>Nummer der aktuellen Seite</td>
<td>-</td>
<td>-</td>
<td>nicht aussagekräftig</td>
<td>aktSeiteNr, currentPageNr</td>
</tr>
<tr>
<td>d</td>
<td>Dateiname</td>
<td>-</td>
<td>-</td>
<td>nicht aussagekräftig</td>
<td><strong>fileName</strong>, filename</td>
</tr>
<tr>
<td>faqUeberschrift</td>
<td>Überschrift der Liste häufig gestellter Fragen</td>
<td>-</td>
<td>-</td>
<td>faqTitel, faqUeberschrift, faqTitle, <strong>faqHeadline</strong>, FAQHeadline</td>
</tr>
<tr>
<td>menHoeh</td>
<td>Höhe eines Menüs</td>
<td>-</td>
<td>-</td>
<td>keine gängigen Abkürzung</td>
<td>menuHeight, navHeight</td>
</tr>
<tr>
<td>strName</td>
<td>Straßenname</td>
<td>-</td>
<td>-</td>
<td>strName, streetName</td>
</tr>
<tr>
<td>wanf</td>
<td>Wandfarbe</td>
<td>-</td>
<td>-</td>
<td>keine gängigen Abkürzung</td>
<td>wandFarbe, wallColor</td>
</tr>
<tr>
<td>PoStLeiTZaHl</td>
<td>Postleitzahl</td>
<td>-</td>
<td>-</td>
<td>falsche Groß- und Kleinschreibweise</td>
<td>plz, postcode, <strong>zipCode</strong>, postalCode</td>
</tr>
<tr>
<td>PLZ</td>
<td>Postleitzahl</td>
<td>-</td>
<td>-</td>
<td>plz, postcode, <strong>zipCode</strong>, postalCode</td>
</tr>
<tr>
<td>plz</td>
<td>Postleitzahl</td>
<td>-</td>
<td>-</td>
<td>plz, postcode, <strong>zipCode</strong>, postalCode</td>
</tr>
<tr>
<td>2.frage</td>
<td>Die 2. Frage</td>
<td>-</td>
<td>-</td>
<td>Syntaxfehler</td>
<td>frageZwei, frage2, question2, <strong>questionTwo</strong></td>
</tr>
<tr>
<td>anzahl?</td>
<td>Die vom Benutzer eingegebene Anzahl von Produktexemplaren, die er kaufen möchte.</td>
<td>-</td>
<td>-</td>
<td>Syntaxfehler</td>
<td>anzProduktExemplar, anzahlProdukt, productAmount</td>
</tr>
<tr>
<td>wichtige Meldung!</td>
<td>Die Variable enthält den Text einer wichtigen Systemmeldung.</td>
<td>-</td>
<td>-</td>
<td>Syntaxfehler</td>
<td>wichtigeMeldung, importantMessage, systemMsg, alertMessage</td>
</tr>
<tr>
<td>pi</td>
<td>Die Zahl π (3.14…)</td>
<td>-</td>
<td>-</td>
<td>Konfigurationsvariable</td>
<td>PI, Math.PI</td>
</tr>
</tbody>
</table>

View File

@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Übung 11: Rechnen mit Strings?</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">
<h2>Übung 11: Rechnen mit Strings?</h2>
<table class="table table-striped">
<thead class="table-dark">
<tr>
<td>Ausdruck</td>
<td>Rückgabewert</td>
</tr>
</thead>
<tbody>
<tr>
<td>'Hallo' + 'Welt'</td>
<td>HalloWelt</td>
</tr>
<tr>
<td>'Hallo' + ' Welt'</td>
<td>Hallo Welt</td>
</tr>
<tr>
<td>'1' + '1'</td>
<td>11</td>
</tr>
<tr>
<td>1 + 1</td>
<td>2</td>
</tr>
<tr>
<td>'1 + 1'</td>
<td>1 + 1</td>
</tr>
</tbody>
</table>
</div>
</main>
<script>
'use strict';
</script>
</body>
</html>

View File

@@ -10,7 +10,7 @@
<main>
<div class="container py-5">
<div class="alert alert-primary my-3">
<h2>Übung 12: Mit prompt das Lieblingsessen erfragen</h2>
<h1>Übung 12: Mit prompt das Lieblingsessen erfragen</h1>
<ol>
<li>
@@ -46,6 +46,16 @@
const favoriteFood = prompt('Dein Lieblingsessen ist..?');
const favoriteDrink = prompt('Dein favorisiertes Getränk ist..?');
outputAEl.textContent =
'Mein Lieblingsessen ist ' + favoriteFood + ' und mein Lieblingsgetränk ist ' + favoriteDrink + '!';
// EMPFEHLUNG
outputBEl.textContent = `Mein Lieblingsessen ist ${favoriteFood} und mein Lieblingsgetränk ist ${favoriteDrink}!`;
// ========
outputCEl.textContent =
'Mein Lieblingsessen ist ' + favoriteFood + ` und mein Lieblingsgetränk ist ${favoriteDrink}!`;
</script>
</body>
</html>

View File

@@ -0,0 +1,57 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Übung 13: Fehler im Detail</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 my-3">
<h2>Übung 13: Fehler im Detail</h2>
<p>Im folgenden Code haben sich einige Fehler und auch Regelwidrigkeiten eingeschlichen.</p>
</div>
<div class="output alert alert-secondary my-3"></div>
</div>
</main>
<script>
'use strict';
const outputEl = document.querySelector('.output');
let tale = `Three hicks were working on a telephone tower - Steve, Bruce and Jed.
Steve falls off and is killed instantly.
As the ambulance takes the body away, Bruce says, 'Someone should go and tell his wife.'
Jed says, 'OK, I'm pretty good at that sensitive stuff, I'll do it.'
Two hours later, he comes back carrying a case of beer.
Bruce says, 'Where did you get that, Jed?'
'Steve's wife gave it to me,' Jed replies.
'That's unbelievable, you told the lady her husband was dead and she gave you beer?'
Well, not exactly', Jed says. 'When she answered the door, I said to her, "You must be Steve's widow".'
She said, 'No, I'm not a widow!'
And I said, 'I'll bet you a case of Budweiser you are.`;
const tale2 =
"Three hicks were working on a telephone tower - Steve, Bruce and Jed.\nSteve falls off and is killed instantly.\nAs the ambulance takes the body away, Bruce says, 'Someone should go and tell his wife.'Jed says, 'OK, I'm pretty good at that sensitive stuff, I'll do it.\n'Two hours later, he comes back carrying a case of beer.\nBruce says, 'Where did you get that, Jed?'\n'Steve's wife gave it to me,' Jed replies.\n'That's unbelievable, you told the lady her husband was dead and she gave you beer?'Well, not exactly', Jed says. 'When she answered the door, I said to her, \"You must be Steve's widow\".'She said, 'No, I'm not a widow!'And I said, 'I'll bet you a case of Budweiser you are.";
console.log(tale);
console.log(tale2);
outputEl.innerHTML = tale.replaceAll('\n', '<br/>');
outputEl.innerHTML = `<p>${tale2.replaceAll('\n', '</p><p>')}</p>`;
</script>
</body>
</html>