My Final Project:)
I chose this trivia game to focus on in my presentation because it was the hardest project for me to code, personally, and I also think it's the most fun for other people.
My dad has always been very good at trivia games, like jeapordy, and somehow he knows all trivia information. So I made this to try to test his trivia skills, and make it somewhat hard for other people to play.
How I did this project:
1.) First I made Ids for the different buttons and boxes, like the "new question" button, "submit" button, and where you add your answer. Making these Ids with adding the command of button, will make it pressable, and the command of input will allow you to input answers. Then I customized these in the style section.
2.) Now onto the most imporant part. For the questions and answers I needed to match them up so when you put your answer and press submit, they will match up correctly. Under javascript, I added "var questionArray" and "var answerArray". This means that starting from 0, whatever question you input into a certain number place of "", will correlate with the answer that is also inputed into the same number place of "".
3.) Then, using an eventlistener with the Id of the "new question" button, you say that when you click a function will run that generates a random number, and whatever number is generated of where the "" is, that question will generate. Then I added an eventlistener to the Id of the "submit" button, that when clicked, it will run a function of the random answer that matches up with the number of the question. Then lastly, I made an alert, so that if the answer does equal the correct answerArray that correlates with the question, it will say correct. And if the answer does not equal the correct answer, the alert will say wrong, and give you the correct answer. Then you can keep re-generating and keep playing.