Save score and return it back as an alert

Hello, im learning javascript by myself, im new to this and also im new in this forum, i want to learn from the people from here.
so my question is, what do i need to do so i can get the score as an alert, im not being able to save the score, it only returns 10 as an alert instead of returning two correct answers which is 20. so it is not adding another 10, im from mexico, sorry my english. Thanks :slight_smile:

var score = 0;

function is_checked(){

var correct = document.getElementById(“correct”).checked,
var incorrect = document.getElementById(“no1”, “no2”, “no3”).checked

if(correct == true){
score =+ 10;
alert(score);
}

}

<meta charset="utf-8">
<title>Quiz</title>
<h1>Random Quiz</h1>

What is the answer?

  1. answer 1
  2. answer 2
  3. answer 3
  4. answer 4
	<h3>What is the answer2?</h3>
<ol type="A">
	<li><input id="correct" type="radio" name="Q2answers" value="ans1" id="correct2">answer 1</li>
    <li><input type="radio" name="Q2answers" value="ans2" id="no1">answer 2</li>
    <li><input type="radio" name="Q2answers" value="ans3" id="no2">answer 3</li>
    <li><input type="radio" name="Q2answers" value="ans4" id="no3">answer 4</li>
</ol>
<input type="submit" name="submit">

There seems to be some code missing, but what I think you’re trying to do is:

(function(){

document.addEventListener("DOMContentLoaded", function(){
     
     const submit = document.querySelector("input[name='submit']");
     submit.addEventListener("click", checkAnswers);

     function checkAnswers(){
          const all_answers = document.querySelectorAll("ol input[type='radio']");
          let score = 0;
          all_answers.forEach(function(answer){
               if (answer.checked && answer.value === "ans1"){
                    score += 10;
               }
          });
          alert(score);
     }

});

})();

Im gonna try that, thank you for helping me out