From 16afea8c47d203b7011de2b429dc3e9d74a44648 Mon Sep 17 00:00:00 2001 From: Slade-de-Plater Date: Mon, 18 Jan 2021 13:08:29 +1100 Subject: [PATCH 1/2] not finished, --- index.html | 2 +- js/index.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index bb8a7dc..20a01ba 100644 --- a/index.html +++ b/index.html @@ -39,7 +39,7 @@

Test your knowledge

- diff --git a/js/index.js b/js/index.js index 67d45f0..387fc9b 100644 --- a/js/index.js +++ b/js/index.js @@ -44,6 +44,16 @@ window.addEventListener('DOMContentLoaded', () => { o: ['Sydney', 'Canberra', 'Melbourne', 'Perth'], a: 1, }, + { + q: 'What is the biggest animal on Earth?', + o: ['Elephant', 'Giraffe', 'Blue Whale', 'Sperm Whale'], + a: 2, + }, + { + q: 'What is the fastest animal on Earth?', + o: ['Bluefin Tuna', 'Cheetah', 'Gazelle', 'Peregrin Falcon'], + a: 3 + } ]; // function to Display the quiz questions and answers from the object @@ -80,11 +90,20 @@ window.addEventListener('DOMContentLoaded', () => { if (radioElement.checked) { // code for task 1 goes here + let answerVal = radioElement.checked; + if (answerVal === true) { + score++; + } else { + console.log(incorrect); + } } } }); }; + + + // call the displayQuiz function displayQuiz(); }); From 620427f385d8c6f54394b800ffeadd983c6257fb Mon Sep 17 00:00:00 2001 From: Slade-de-Plater Date: Mon, 18 Jan 2021 13:31:03 +1100 Subject: [PATCH 2/2] new --- js/index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/js/index.js b/js/index.js index 387fc9b..06fc8f7 100644 --- a/js/index.js +++ b/js/index.js @@ -89,21 +89,22 @@ window.addEventListener('DOMContentLoaded', () => { } if (radioElement.checked) { - // code for task 1 goes here - let answerVal = radioElement.checked; - if (answerVal === true) { - score++; - } else { - console.log(incorrect); - } + score++ } } }); }; - +//Couldn't figure out where to put eventListner. +//const submit = document.querySelector('#btnSubmit'); +//submit.addEventListener('click', function () { + //clearInterval(timer); + //calculateScore(); + //}; // call the displayQuiz function displayQuiz(); }); + +