DEV Community

huberto_madalena
huberto_madalena

Posted on

simple quiz in javascript

<!DOCTYPE html>


quiz

q1. 2+3?

5

8

10

9

q2. 3+3?

6

8

10

9

q3. 2+1?

3

8

10

9

function result()
{
var score =0;
if (document.getElementById('correct1').checked)
{
score++;
}

if (document.getElementById('correct2').checked)
{
score++;
}

if (document.getElementById('correct3').checked)
{
score++;
}

alert("your score is: " +score);

}

Top comments (0)