ب
{text: 'Monteimage', correct: false}
]
},
{
question:'What is the capital of China?',
answers:[
{text: 'Tianjin', correct: false},
{text: 'Beijing', correct: true},
{text: 'Shanghai', correct: false},
{text: 'Chongqing', correct: false}
]
},
{
question:'What is the population of Ukraine?',
answers:[
{text: '25 million', correct: false},
{text: '42 million', correct: true},
{text: '10 million', correct: false},
{text: '78 million', correct: false}
]
},
{
question:'What is the population of Austria?',
answers:[
{text: '21 million', correct: false},
{text: '5 million', correct: false},
{text: '9 million', correct: true},
{text: '94 million', correct: false}
]
},
{
question:'What is the capital of El Salvador?',
answers:[
{text: 'El Salvador', correct: false},
{text: 'San Salvador', correct: true},
{text: 'Die Salvador', correct: false},
{text: 'The Salvador', correct: false}
]
},
{
question:'Ouagadougou is a capital of...',
answers:[
{text: 'Burkina Faso', correct: true},
{text: 'Zimbabwe', correct: false},
{text: 'Trinidad and Tobago', correct: false},
{text: 'Bosnia and Herzegovina', correct: false}
]
},
{
question:'Nur-Sultan is a capital of...',
answers:[
{text: 'Kyrgizstan', correct: false},
{text: 'Kazakhstan', correct: true},
{text: 'Trinidad and Tobago', correct: false},
{text: 'Yemen', correct: false}
]
},
{
question:'Minsk is a capital of...',
answers:[
{text: 'Kyrgizstan', correct: false},
{text: 'Kazakhstan', correct: false},
{text: 'Belarus', correct: true},
{text: 'Azerbaijan', correct: false}
]
},
{
question:'Taj Mahal is located in...',
answers:[
{text: 'India', correct: true},
{text: 'Kazakhstan', correct: false},
{text: 'USA', correct: false},
{text: 'Russia', correct: false}
]
}
]
// Random order of questions
let shuffledQuestions = questions.sort(() => Math.random()-0.5);
let questionNumber = 0;
const showQuestion = () => {
if (questionNumber >= 15){
clearInterval(qtimer);
submit.style.pointerEvents = 'none';
submit.style.background = '#1f7a1f';
submit.style.color = "#eee";
Swal.fire({
icon: 'success',
title: "Quiz Completed!",
text:
You scored ${correct} out of 15.\nReload the page to play again. You will see some new questions as they are random!
, showCancelButton: false,
showConfirmButton: false
})
/*
.then((result) => {
if (result.value) {
startGame();
}
})
*/
// restatring causes some weird problems
} else {
qtimer = setInterval(countdown, 1000);
breadth = 100;
countdown();
answers_holder.innerHTML = null;
document.querySelector(".qtext").innerText = questions[questionNumber].question;
questions[questionNumber].answers.forEach((element, index) => {
let button = document.createElement("button");
button.innerText = questions[questionNumber].answers[index].text;
button.classList.add("answer");
if (questions[questionNumber].answers[index].correct) {
button.classList.add("correct");