title: How can I reset my SetInterval when going to next question?
body: <p>I'm building a quiz and now have the problem when going to the next question that my timer is doing weird.... it jumps for example from 4 to 9 and then to 3 but I want it to go to 10 again and just countdown to 0 and jump to the next question. Could someone explain me this? Or is it better to use SetInterval? It would be appreciated if you could help me out with this!</p>
  
  <pre><code>var currentQuestion = 0;
  var currentCount = 0;
  var maxCount = 3;
  var totalScore = 0;
  
  function displayQuestion() {
    var question = allQuestions[currentQuestion].question;
    var showQuestion = $(document).find(".question-full");
  
    var showQuestionImage = $(document).find(".questions-img");
    var questionImage = allQuestions[currentQuestion].questionImg;
  
    var numAnswers = allQuestions[currentQuestion].responses.length;
    var answerList = $(document).find(".answers-buttons");
  
    /// SCORE
    var scoreCounter = $(document).find(".scoreCounter");
  
    $(showQuestion).text(question);
    $(showQuestionImage).html(questionImage);
  
    $(answerList).find("li").remove();
    $(scoreCounter).find("span").remove();
    $('.result-container').find("h2").remove();
    $('.result-container').find("img").remove();
    $('.result-container').find("a").remove();
  
    $('&lt;span&gt;'+ totalScore +'&lt;/span&gt;').appendTo(scoreCounter);
  
    var answers;
    var score;
    for(var i = 0; i &lt; numAnswers; i++) {
      answers = allQuestions[currentQuestion].responses[i].text;
      score = allQuestions[currentQuestion].responses[i].score;
      $('&lt;li&gt;&lt;button class="nextButton" data-score="'+ score +'" type="button"&gt;'+answers+'&lt;/button&gt;&lt;/li&gt;').appendTo(answerList);
    }
  
    nextQuestion();
  
  
    $(".nextButton").on("click", function () {
      var score = $(this).data('score');
      IncreaseScore();
  
      currentQuestion++;
  
      totalScore += score;
  
      if (currentQuestion &lt; allQuestions.length) {
          displayQuestion();
      } else {
        $('.after-container').fadeIn('slow');
        $('.content').fadeOut('slow');
      }
    });
  }
  
  
  function nextQuestion() {
    var tijd = 10;
    var interval = setInterval(function() {
      tijd--;
      document.getElementById("countdowntimer").textContent = tijd;
      if(tijd == 0) {
        currentQuestion++;
        displayQuestion();
        console.log(tijd);
        clearInterval(tijd);
      }
    }, 1000);
  }
  
  function IncreaseScore() {
  
    currentCount++;
  
    if (currentCount &gt; maxCount) {
      currentCount--;
    }
  }
  </code></pre>