Resetting score to 0 after quiz completed
<h1>Problem</h1>
<p>I have a <code>resetQuiz()</code> quiz button at the bottom of the page, which is supposed to set the score back to 0, but if the person has gotten 25 correct answers, clicks <code>.button__reset</code> and then does the quiz again, it goes to 26 instead of 0.</p>
<p>Live link: <a href="https://s3.amazonaws.com/bsunproduction/yearinreview/index.html" rel="nofollow noreferrer">https://s3.amazonaws.com/bsunproduction/yearinreview/index.html</a></p>
<h2>scripts.js</h2>
<pre><code>/*-------------------------------------
QUIZ
--------------------------------------*/

// Keep track of score
function showScoreBox() {
    var scrollDepth = $(window).scrollTop();
    var divPosition = $(&quot;.quiz__header&quot;).offset().top - 45;
    var windowWidth = $(window).width();
    // console.log(windowWidth);

    if (scrollDepth &gt; divPosition &amp;&amp; (windowWidth &gt; 768)) {
        $(&quot;.quiz__score&quot;).show();
        $(&quot;.quiz__score--mobile&quot;).hide();
    } else {
        $(&quot;.quiz__score&quot;).hide();
        $(&quot;.quiz__score--mobile&quot;).show();
    }
} showScoreBox();

$(window).on(&quot;scroll&quot;, function(){
    showScoreBox();
});

$(window).on(&quot;resize&quot;, function(){
    showScoreBox();
});

var score = 0;

$(document).on(&quot;click&quot;, &quot;.quiz__response&quot;, function(){
    $(this).siblings().addBack().addClass(&quot;is--unclickable&quot;);
    $(this).siblings().show(&quot;quiz__info&quot;);  // Show extra info
    console.log(&quot;Clicked&quot;);

    if ($(this).hasClass(&quot;answer--true&quot;)) {
        $(this).addClass(&quot;is--true&quot;);
        $(this).find(&quot;i&quot;).show();
        $(this).siblings().find(&quot;i&quot;).show();

        // Update score
        score++
        console.log(score);
        $(&quot;.quiz__correct&quot;).html(score);
        $(&quot;.quiz__correct--mobile&quot;).html(score);
        rainConfetti();
    } else {
        // $(this).addClass(&quot;is--true&quot;);
        // $(this).siblings().addClass(&quot;is--false&quot;);
        // $(&quot;quiz__info&quot;).removeClass(&quot;is--false&quot;);
        $(this).addClass(&quot;is--false&quot;);
        $(this).find(&quot;i&quot;).show();
        $(this).siblings().find(&quot;i&quot;).show();
    }
});

/*-------------------------------------
RESET
--------------------------------------*/

function resetQuiz() {
    var score = 0;
    $(&quot;.quiz__response&quot;).removeClass(&quot;is--true is--false&quot;);
    $(&quot;.quiz__response&quot;).removeClass(&quot;is--unclickable&quot;);
    $(&quot;.fa-check&quot;).hide();
    $(&quot;.fa-times&quot;).hide();
    $(&quot;.quiz__correct&quot;).html(score);
    $(&quot;.quiz__correct--mobile&quot;).html(score);
}

$(&quot;.button__reset&quot;).on(&quot;click&quot;, function(){
    var score = 0;
    $(&quot;canvas&quot;).hide();
    resetQuiz();
});
</code></pre>