Skip to content

Conversation

@Jess2896
Copy link
Owner

@Jess2896 Jess2896 commented Oct 15, 2019

  • Trivia game where you log the answer into a prompt.

Challenge requirements

  1. Build a function constructor called Question to describe a question. A question should include: a) the question itself, b) the answers, c) the correct answer.

  2. Create a couple of questions using the constructor.

  3. Store them all inside an array.

  4. Select one random question and log it on the console, together with the possible answers (each question should have a number).

  5. Use the 'prompt' function to ask the user for the correct answer such as you displayed it on task 4.

  6. Check if the answer is correct and print to the console whether the answer is correct or not.

  7. Suppose this code would be a plugin for other programmers to use in their code. So make sure all your code is private and doesn't interfere with the other programmers code.

  8. After you display the result, display the next random question, so that the game never ends.

  9. Be careful: after task 8, the game literally never ends. So include the option to quit the game if the user writes 'exit' instead of the answer.

  10. Track the user's score to make the game more fun. So each time an answer is correct, add 1 point to the score.

  11. Display the score in the console.

Verification steps

  • Download all the files into a folder and then open the index.html file on a browser.

  • Enter 'exit' in the prompt that pops up, then proceed to inspect the site and open the console.

  • Once the console has been opened, reload the site.

  • Answer the questions on the prompt.

  • Check that your score increments if you answer correctly.

  • Check that the game can be ended by typing 'exit' in the prompt and that it shows your final score correctly.

@Jess2896 Jess2896 requested a review from oscarpolanco October 15, 2019 15:23
@Jess2896 Jess2896 force-pushed the seventh-challenge branch 2 times, most recently from 02b0c86 to 6f671cd Compare October 16, 2019 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants