I have this javascript code that is not working. Althought the first conditional(if conditional) is working, the else conditional is not working. Sorry for my bad english.
function choice1()
    {
        if(pic_location<9)
        {
            if(document.getElementById("choice_1").value==character[numbers[pic_location]])
            {
                window.alert("Guess Correct!");
                score = score + 1;
                document.getElementById("score").innerHTML = score;
                pic_location=pic_location + 1;
                document.getElementById("pic").setAttribute("src", "pictures/" + character[numbers[pic_location]] + ".jpg");
            }
            else
            {
                window.alert("Wrong Answer!");
                pic_location=pic_location + 1;
                document.getElementById("pic").setAttribute("src", "pictures/" + character[numbers[pic_location]] + ".jpg");
            }
            set_choices();
            document.getElementById("qn").innerHTML= pic_location + 1;
        }
        else
        {
            if(pic_location==10)
            {
                document.getElementById("choice_1").value==character[numbers[pic_location]];
                window.alert("Guess Correct");
                score = score +1;
                window.location="game3.php";
            }
            else
            {
                window.alert("Wrong Guess!");
                window.location="game3.php";
            }
        }
        
    }
The if function is working fine when i run it but when I get to the last photo location which is 10, it always guesses wrong even though the answer is right.
Note: my function is the same for the four choices. They all have the same problems.
 
    