window.OneSignal = window.OneSignal || []; OneSignal.push(function() { OneSignal.init({ appId: "b4fefaa1-460b-4a5c-956a-67fdda2390c6", }); });

Our Blog

Blog2023-07-16T13:42:40+00:00

Inner Strength – Unlimited Collection – NFT 01

Type A vs. Type B – A Hilarious Journey to Find Mr. Right!

The California Love Chronicles: Unveiling the Secrets to Lasting Relationships in the Golden State

7 Heartwarming Ways to Brighten Someone’s Day and Spread Smiles


function play_quiz(questions) {
    var score = 0;
    for (var i = 0; i < questions.length; i++) {
        console.log(questions[i].question);
        for (var j = 0; j < questions[i].options.length; j++) {
            console.log((j + 1) + ". " + questions[i].options[j]);
        }
        var user_answer = parseInt(prompt("Enter the option number (1-4):"));
        if (!isNaN(user_answer) && user_answer >= 1 && user_answer <= 4) {
            if (questions[i].answer === user_answer) {
                score++;
                console.log("Correct!");
            } else {
                console.log("Incorrect!");
            }
        } else {
            console.log("Invalid input. Skipping the question.");
        }
        console.log("");
    }

    console.log("Quiz completed!");
    console.log("You scored " + score + " out of " + questions.length + ".");
}

// Define the quiz questions
var questions = [
    {
        question: "What is the capital of France?",
        options: ["Paris", "London", "Berlin", "Madrid"],
        answer: 1
    },
    {
        question: "Which planet is known as the Red Planet?",
        options: ["Mars", "Jupiter", "Saturn", "Venus"],
        answer: 1
    },
    // Add more questions here...
];

// Start the quiz
play_quiz(questions);

Title

Go to Top