This commit is contained in:
Philippe Torrel
2026-09-16 10:38:23 +02:00
parent 99007ffc89
commit dc1e06ac67
16 changed files with 159 additions and 27 deletions
+39 -8
View File
@@ -35,16 +35,47 @@
<script>
'use strict';
// const QUESTION_1 = 'es geht los! Sag mir mal, welcher Operator die höhere Priorität hat: * oder + ?';
// const SOLUTION_1 = '*';
const QUESTION_1 = 'Which Operators has the higher priority: * or + ?';
const SOLUTION_1 = '*';
// const QUESTION_2 = 'Was ist das deutsche Wort für if?';
// const SOLUTION_2A = 'falls';
// const SOLUTION_2B = 'wenn';
const QUESTION_2 = "What's the German word for if";
const SOLUTION_2A = 'wenn';
const SOLUTION_2B = 'falls';
// const QUESTION_3 = 'Jetzt gib bitte einen String mit einer Länge von 8 bis 15 Zeichen ein';
// const SOLUTION_3A = 8;
// const SOLUTION_3B = 15;
const QUESTION_3 = 'Now, please enter a string with a length between 8 and 15 characters…';
const SOLUTION_3A = 8;
const SOLUTION_3B = 15;
// 1.Als ersten Schritt fragen Sie den Spieler nach seinem Namen, speichern diesen in eine Variable und begrüßen ihn mittels einer Alert-Box.
const name = prompt('Wie heißen Sie?');
alert(`Hallo ${name}`);
// 2.Stellen Sie dem Spieler die Frage, ob er sich fit genug fühlt, um gegen das dunkle JavaScript anzutreten. Es ist sinnvoll, bei der Frage die Antwortmöglichkeiten anzugeben.
const fitness = prompt('Fühlen Sie sich fit genug, um gegen das dunkle JavaScript anzutreten. ja oder nein?')
.toLowerCase()
.trim();
if (fitness === 'ja' || fitness === 'j') {
alert('Das Spiel startet! Gib alles !');
let answer = prompt(QUESTION_1);
if (answer === SOLUTION_1) {
alert('Gratulation');
let answer = prompt(QUESTION_2).toLowerCase().trim();
if (answer === SOLUTION_2A || answer === SOLUTION_2B) {
alert('Gratulation');
let answer = prompt(QUESTION_3);
if (answer.length >= SOLUTION_3A && answer.length <= SOLUTION_3B) {
alert('Gratulation');
} else {
alert('Das war falsch!');
}
} else {
alert('Das war falsch!');
}
} else {
alert('Das war falsch!');
}
} else if (fitness === 'nein') {
alert('Go Home');
}
</script>
</body>
</html>