diff --git a/debugging/calculateSum.js b/debugging/calculateSum.js index 95aba17d828b5344873a3a8c88d1eadf1dd28f86..251de6b56b841e39ad94305c97c9917512b0484e 100644 --- a/debugging/calculateSum.js +++ b/debugging/calculateSum.js @@ -1,13 +1,13 @@ function calculateSum(numbers) { - let sum = 0; + let sum = 0; - for (let i = 0; i <= numbers.length; i++) { - sum += numbers[i]; - } - - return sum; + for (let i = 0; i <= numbers.length; i++) { + sum += numbers[i]; } + + return sum; +} - const myNumbers = [10, 20, 30, 40, 50]; - const result = calculateSum(myNumbers); - console.log("The sum is:", result); \ No newline at end of file +const myNumbers = [10, 20, 30, 40, 50]; +const result = calculateSum(myNumbers); +console.log("The sum is:", result); \ No newline at end of file diff --git a/debugging/debug.js b/debugging/debug.js index ee25026485ea14b8246d8463263cb79cbff1c8ac..55d8fb9bec6a4fe8ba57ccef2e6071575278962e 100644 --- a/debugging/debug.js +++ b/debugging/debug.js @@ -1,19 +1,20 @@ function makeUpperCase(name) { -if (typeof name !== "string") { - throw new Error("Name must be a string"); -} -else { - return name.toUpperCase(); -} + if (typeof name !== "string") { + throw new Error("Name must be a string"); + } + else { + return name.toUpperCase(); + } } +let result try { - let result = makeUpperCase(1223); + result = makeUpperCase(1223); } catch (error) { - console.log("Da gab es einen Fehler: ", error.message); + console.log("Da gab es einen Fehler: ", error.message); } - +console.log(result) diff --git a/debugging/recipe.js b/debugging/recipe.js index a4206fe2bfefc90f2b41c3d21d6c7dea987d4ac0..5535848c03578ecbb112e699a2f5ae4f6bf6a626 100644 --- a/debugging/recipe.js +++ b/debugging/recipe.js @@ -1,11 +1,11 @@ function brewPotion(ingredient1, ingredient2) { - // Ensure both ingredients are provided - if (!ingredient1 || !ingredient2) { - throw new Error("Both ingredients are required."); - } + // Ensure both ingredients are provided + if (!ingredient1 || !ingredient2) { + throw new Error("Both ingredients are required."); + } - // Combine the ingredients with a dash and capitalize them correctly - return ingredient1 + ingredient2 + // Combine the ingredients with a dash and capitalize them correctly + return ingredient1 + ingredient2 } console.log(brewPotion("apple")) \ No newline at end of file diff --git a/debugging/username.js b/debugging/username.js index 4822526e152666ed8e902e526ff423ffb547ac83..0df41587748ee2aff5c3312aa537beca11515869 100644 --- a/debugging/username.js +++ b/debugging/username.js @@ -1,7 +1,7 @@ function greetUser(name) { - let greeting = "Hello, " + name + "!"; - console.log(greeting); - } + let greeting = "Hello, " + name + "!"; + console.log(greeting); +} - const userName = "Alice"; - greetUser(username); \ No newline at end of file +const userName = "Alice"; +greetUser(username); \ No newline at end of file diff --git a/helper/quizData.js b/helper/quizData.js index f2776bbfa0a6f130371e80acd9152e2bde21c2e5..134fbd49fb8208c62aa476f5f874089e1190ee65 100644 --- a/helper/quizData.js +++ b/helper/quizData.js @@ -1,34 +1,35 @@ const questions = [ - { - category: "Geography", - question: "What is the capital of France?", - choices: ["London", "Paris", "Berlin", "Rome"], - answer: "Paris" -}, - { - category: "Movies", - question: "What is the name of the main character in The Matrix?", - choices: ["Neo", "Trinity", "Morpheus", "Cypher"], - answer: "Neo" -}, - { - category: "History", - question: "Who was the first president of the United States?", - choices: ["John Adams", "Thomas Jefferson", "George Washington", "Abraham Lincoln"], - answer: "George Washington" -}, - { - category: "Sports", - question: "Which team won the World Cup in 2018?", - choices: ["France", "Brazil", "Germany", "Italy"], - answer: "France" -} , - { - category: "Science", - question: "What is the chemical symbol for gold?", - choices: ["Au", "Ag", "Pt", "Cu"], - answer: "Au" -} + { + category: "Geography", + question: "What is the capital of France?", + choices: ["London", "Paris", "Berlin", "Rome"], + answer: "Paris" + }, + { + category: "Movies", + question: "What is the name of the main character in The Matrix?", + choices: ["Neo", "Trinity", "Morpheus", "Cypher"], + answer: "Neo" + }, + { + category: "History", + question: "Who was the first president of the United States?", + choices: ["John Adams", "Thomas Jefferson", + "George Washington", "Abraham Lincoln"], + answer: "George Washington" + }, + { + category: "Sports", + question: "Which team won the World Cup in 2018?", + choices: ["France", "Brazil", "Germany", "Italy"], + answer: "France" + } , + { + category: "Science", + question: "What is the chemical symbol for gold?", + choices: ["Au", "Ag", "Pt", "Cu"], + answer: "Au" + } ] export default questions \ No newline at end of file