Coding Challenge1

From rbachwiki
Revision as of 23:01, 8 November 2016 by Bacchas (talk | contribs)
Jump to navigation Jump to search

1. Build a function constructor called question to describe a question. A question should include
a. Question itself
b. the answer from which the player can choose the correct one ( choose and adequate data structure here, array object etc.)
c. correct answer

2. Create a couple of questions using the constructor

3. Store them all inside the array

4. Select one random question and log it to 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. the user should input the number of the correct answer such as you displayed 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 another programmer to use in their code. so make sure that all your code is private and doesn't interfere with the other programmers code.

Back To Top- Home - Category