1var myQuestions = [
2 {
3 question: "What is 10/2?",
4 answers: {
5 a: '3',
6 b: '5',
7 c: '115'
8 },
9 correctAnswer: 'b'
10 },
11 {
12 question: "What is 30/3?",
13 answers: {
14 a: '3',
15 b: '5',
16 c: '10'
17 },
18 correctAnswer: 'c'
19 }
20];
1<div id="quiz"></div>
2<button id="submit">Get Results</button>
3<div id="results"></div>
1function generateQuiz(questions, quizContainer, resultsContainer, submitButton){
2
3 function showQuestions(questions, quizContainer){
4 // code will go here
5 }
6
7 function showResults(questions, quizContainer, resultsContainer){
8 // code will go here
9 }
10
11 // show the questions
12 showQuestions(questions, quizContainer);
13
14 // when user clicks submit, show results
15 submitButton.onclick = function(){
16 showResults(questions, quizContainer, resultsContainer);
17 }
18}