Math Quiz Worksheet
Step 1
- Ask user to choose from 3 types of quizzes (+, -, *) with prompt()
- Declare variable: operation to store the input
- Declare variable: score and set it to 0
- Declare 4 variables: num1, num2, ans, userAns
Step 2
- Select 2 random numbers using Math.random() * 10
- Use Math.round() to round numbers to integer
- Assign numbers into num1 and num2
Step 3
- Detect question type
- Set ans variable according to question
- Ask question using prompt() and store it to userAns
Step 4
- Check answer
- If correct, add 1 to score and inform user through console.log()
- Else, minus 1 from score and inform user through console.log()
Step 5
- Repeat for at least 20 questions
- Stop the loop if the user click Cancel
Step 6
- Display total score with alert()