Weekly Dev Challenge: QUIZ application

Bishnu Prasad Chowdhury
3 min readFeb 27, 2021

--

This week’s SCRIMBA’s weekly dev challenge was creating a QUIZ application.

So went ahead and created the default UI in HTML and it looked like below:

This application will show score, a question with 4 options, a Submit button and a next question button and a label to show correct/incorrect answers.

I stored all the questions in a JS object with key as the questions inside the object and answer options in another key with name answers.

Next thing i did was declare all the DOM elements to use them inside the JavaScript.

I created two functions for the two buttons, one submitAnswers which would verify the answer of the question and show correct/incorrect messages and add 1 to the score and another nextQuestion which would load the next question from the myQuestions JS object.

I had another function computeResult that would verify the user option is correct or incorrect. If correct it will increment the global score else it would show an incorrect message with correct answer.

The html looks like this

And the CSS looks like this:

So the final output of the program looks like below :

For correct answer

For incorrect answer

Error handling

End Screen:

So if you would like to share some feedback to refactor the code, please go ahead.

https://scrimba.com/scrim/cof004867a567d940bca4adf2

--

--

Bishnu Prasad Chowdhury
Bishnu Prasad Chowdhury

Written by Bishnu Prasad Chowdhury

I love to learn about new technologies and new thing now and then. I get bored with thing very easily so i tend to move from one technology to another.

No responses yet