This commit is contained in:
Philippe Torrel
2026-11-03 11:40:59 +01:00
parent a885cd9550
commit baf557f666
17 changed files with 1158 additions and 19 deletions
@@ -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 6: Benutzer erstellen</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 6: Benutzer erstellen</h2>
<p>
Nehmen wir eine anspruchsvollere Syntaxfehlerübung in Angriff. Diese Übung enthält mehrere Syntaxfehler, die
über den gesamten Code verteilt sind. Dein Ziel ist es, alle Syntaxfehler zu identifizieren und zu beheben,
damit der Code korrekt ausgeführt werden kann.
</p>
</div>
</div>
</main>
<script>
'use strict';
function createUser(name, email, age) {
return {
name,
email,
age,
greet() {
console.log(`Hello, ${this.name}!`);
},
updateEmail(newEmail) {
this.email = newEmail;
console.log(`Email updated to ${this.email}`);
},
};
}
const users = [
createUser('Alice', 'alice@example.com', 30),
createUser('Bob', 'bob@example.com', 25),
createUser('Charlie', 'charlie@example.com', 35),
];
users.forEach((user) => {
user.greet();
user.updateEmail(`new_${user.email}`);
});
function calculateTotal(...numbers) {
return numbers.reduce((sum, n) => sum + n, 0);
}
console.log('Total:', calculateTotal(10, 20, 30));
</script>
</body>
</html>