Files
JS/01_grundlagen/uebungen/#u23_validierung-prompt.html
Philippe Torrel 9e7d4cc4ca
2026-06-22 14:48:45 +02:00

41 lines
1.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Übung 23: Von guten und bösen Eingaben</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 23: Von guten und bösen Eingaben</h2>
<ol class="list">
<li>
Nimm Angaben zu Vorname, Nachname, Alter und dem liebsten Heißgetränk eines Anwenders entgegen und
speichere diese in Variablen.
</li>
<li>
Diese Eingaben sollst du nun folgendermaßen validieren:
<ul class="list">
<li>Vorname und Nachname müssen zwischen 2 und 100 Zeichen lang sein.</li>
<li>Das Alter muss eine Zahl unter 150 sein.</li>
<li>Die Eingabe für das Getränk muss c (coffee) oder t (tea) sein.</li>
</ul>
</li>
</ol>
</div>
</div>
</main>
<script>
'use strict';
// Aufgabe
const firstName = prompt('Wilkommen. Wie heißen Sie mit Vornamen?');
const lastName = prompt('Und mit Nachnamen??');
const favoriteHotDrink = prompt('Und was ist ihr liebstes Heißgetränk??? (tee | kaffee)');
</script>
</body>
</html>