``` // Define the quiz questions and answers const questions = [ { question: "What is the capital of France?", choices: ["London", "Paris", "Madrid", "Berlin"], answer: "Paris" }, { question: "What is the highest mountain in the world?", choices: ["Mount Everest", "K2", "Makalu", "Dhaulagiri"], answer: "Mount Everest" }, { question: "What is the largest country in the world?", choices: ["Russia", "Canada", "China", "USA"], answer: "Russia" } ]; // Set up the user interface const quizContainer = document.getElementById("quiz"); const resultsContainer = document.getElementById("results"); const submitButton = document.getElementById("submit"); // Create the quiz logic function showQuizQuestions() { const output = []; questions.forEach((currentQuestion, questionNumber) => { const choices = []; for (let i = 0; i < currentQuestion.choices.length; i++) { choices.push( `` ); } output.push( `
${currentQuestion.question}
${choices.join("")}
` ); }); submitButton.addEventListener("click", showQuizResults); ``

Comments