script.js
//Starts timer and triggers the quiz to start. 
Starts timer and triggers the quiz to start.
Starts timer and triggers the quiz to start .
function startTimer(event) {
    event.preventDefault()
    startBtn.style.display = "none";
    modalEl.style.display = "none";
    highScorelink.style.display = "none";
    var timeInterval = setInterval(function () {
        timer.textContent = "Time Remaining: " + currentTimer;
        currentTimer--;
        if (currentTimer === 0 || currentTimer < 0) {
            timer.textContent = "";
            timesUp.style.display = "block";
            highScorelink.style.display = "none";
            currentQuestion.textContent = "";
            optionsUl.style.display = "none";
            startBtn.style.display = "block";
            startBtn.textContent = "Try Again";
            startBtn.addEventListener("click", function (event) {
                window.location.reload();
            });
            clearInterval(timeInterval);
        } else if (index > quiz.length - 1) {
            timer.textContent = "";
            init();
            clearInterval(timeInterval);
        }
    }, 1000);
    startQuiz(1);
}
function startTimer ( event ) { event . preventDefault ( ) startBtn . style . display = "none" ; modalEl . style . display = "none" ; highScorelink . style . display = "none" ; var timeInterval = setInterval ( function ( ) { timer . textContent = "Time Remaining: " + currentTimer ; currentTimer -- ; if ( currentTimer === 0 || currentTimer < 0 ) { timer . textContent = "" ; timesUp . style . display = "block" ; highScorelink . style . display = "none" ; currentQuestion . textContent = "" ; optionsUl . style . display = "none" ; startBtn . style . display = "block" ; startBtn . textContent = "Try Again" ; startBtn . addEventListener ( "click" , function ( event ) { window . location . reload ( ) ; } ) ; clearInterval ( timeInterval ) ; } else if ( index > quiz . length - 1 ) { timer . textContent = "" ; init ( ) ; clearInterval ( timeInterval ) ; } } , 1000 ) ; startQuiz ( 1 ) ; }
Starts timer and triggers the quiz to start.
Starts timer and triggers the quiz to start .