const headerQuestion = document.getElementById('header-question');
let oldQuestionIndex = -1;
const labelAnswerA = document.getElementById('label-answer_A');
const labelAnswerB = document.getElementById('label-answer_B');
const labelAnswerC = document.getElementById('label-answer_C');
const labelAnswerD = document.getElementById('label-answer_D');
let arrAnswerVaranty = ['a', 'b', 'c', 'd'];
const btnSubmit = document.querySelector('.btn-submit');
question: 'What is the most used programming language in 2019?',
answers: ['Java', 'C', 'Python', 'JS']
question: 'Who is the President of US?',
answers: ['Florin Pop', 'Joe Biden', 'Ivan Saldano', 'Mihai Andrei']
question: 'What does HTML stand for?',
'Hypertext Markup Language',
'Helicopters Terminals Motorboats Lamborgini'
question: 'What year was JavaScript launched?',
answers: ['1996', '1995', '1994', 'none of the above']
function getRandomQuestion() {
currentRandomIndex = Math.floor(Math.random() * quizArr.length);
} while (currentRandomIndex === oldQuestionIndex);
oldQuestionIndex = currentRandomIndex;
return quizArr[currentRandomIndex].question;
function getRandomVariants(currentRandomIndex) {
const answersIndicies = [];
for (const value of quizArr[currentRandomIndex].answers) {
let oldAnswersIndex = -1;
oldAnswersIndex = Math.floor(Math.random() * quizArr[currentRandomIndex].answers.length);
} while (answerIndicies.includes(oldAnswersIndex));
answersIndicies.push(oldAnswersIndex);
function showRandomQuestion() {
const displayQuestQiz = getRandomQuestion();
headerQuestion.innerHTML = displayQuestQiz;
btnSubmit.addEventListener('click', function() {