diff --git a/DevQuiz/index.html b/DevQuiz/index.html index 410b267..c02616f 100644 --- a/DevQuiz/index.html +++ b/DevQuiz/index.html @@ -125,7 +125,7 @@

Quiz
- Question => {1/10}

+ Question => {1/20}

Score(0) diff --git a/DevQuiz/script.js b/DevQuiz/script.js index d0de9a2..fe9838a 100644 --- a/DevQuiz/script.js +++ b/DevQuiz/script.js @@ -25,17 +25,18 @@ const languageSelect = document.getElementById("language"); //question tracker variables const questionCountElement = document.querySelector(".question-count"); const questionsAskedElement = document.querySelector(".questions-asked-array"); -const questionArrayLengthElement = document.querySelector(".questions-array-length"); +const questionArrayLengthElement = document.querySelector( + ".questions-array-length", +); -function updateQuestionCountElement(count){ - //this function is for debugging purposes only - questionCountElement.innerHTML = `question count: ${count}`; +function updateQuestionCountElement(count) { + //this function is for debugging purposes only + questionCountElement.innerHTML = `question count: ${count}`; } -function updateQuestionsArrayLengthElement(length) -{ - //this function is for debugging purposes only - questionArrayLengthElement.innerHTML = `question array length: ${length} ` +function updateQuestionsArrayLengthElement(length) { + //this function is for debugging purposes only + questionArrayLengthElement.innerHTML = `question array length: ${length} `; } const readInstructionBtn = document.querySelector(".read-instruction"); @@ -46,97 +47,179 @@ const instExitBtn2 = document.querySelector(".close-btn2"); let questionIndex = 0; let questionsAsked = []; // to store asked questions let score = 0, - questionCount = 0; + questionCount = 0; updateQuestionCountElement(questionCount); // Questions and MCQs for all languages const quizzes = { - javascript: { - questions: [ - "What is the result of 2 + '2' in JavaScript?", - "Which of the following is not a JavaScript data type?", - "Which company developed JavaScript?", - "What type of language is JavaScript?", - "Inside which HTML element do we put the JavaScript?", - "What keyword is used to declare a variable in JavaScript?", - "Which built-in method adds one or more elements to the end of an array and returns the new length?", - "What is the main purpose of a constructor function in JavaScript?", - "Which method is used to remove the last element from an array in JavaScript?", - "What is the significance of the 'this' keyword in JavaScript?" - - ], - options: [ - ["Error", "4", "NaN", "22"], - ["Boolean", "Alert", "Number", "String"], - ["Netscape", "Bell Labs", "Sun Microsystems", "IBM"], - ["Object-Oriented", "Object-Based", "Assembly-language", "High-level"], - ["", "", "