|
8 | 8 |
|
9 | 9 | <body>
|
10 | 10 | <h1>Coding Challenge 6 in JavaScript!</h1>
|
11 | | - <br><h4>Let's build a fun quiz game in the console!</h4> |
| 11 | + <h4>Let's build a fun quiz game in the console!</h4> |
12 | 12 |
|
13 | | -<p><br>1. Build a function constructor called Question to describe a question. A question should include:<br> |
14 | | -a) question itself<br> |
15 | | -b) the answers from which the player can choose the correct one (choose an adequate data structure here, array, object, etc.)<br> |
16 | | -c) correct answer (I would use a number for this)<br><br> |
17 | | - |
18 | | -2. Create a couple of questions using the constructor<br><br> |
19 | | - |
20 | | -3. Store them all inside an array<br><br> |
21 | | - |
22 | | -4. Select one random question and log it on the console, together with the possible answers (each question should have a number) (Hint: write a method for the Question objects for this task).<br><br> |
23 | | - |
24 | | -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 it on Task 4.<br><br> |
25 | | - |
26 | | -6. Check if the answer is correct and print to the console whether the answer is correct ot nor (Hint: write another method for this).<br><br> |
27 | | - |
28 | | -7. Suppose this code would be a plugin for other programmers to use in their code. So make sure that all your code is private and doesn't interfere with the other programmers code (Hint: we learned a special technique to do exactly that). </p> |
29 | | -<script src="script.js"></script> |
| 13 | + <p><br>1. Build a function constructor called Question to describe a question. A question should include:<br> a) question itself<br> b) the answers from which the player can choose the correct one (choose an adequate data structure here, array, object, etc.)<br> c) correct answer (I would use a number for this)<br><br> 2. Create a couple of questions using the constructor<br><br> 3. Store them all inside an array<br><br> 4. Select one random question and log it on the console, together with the possible answers (each question should have a number) (Hint: write a method for the Question objects for this task).<br><br> 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 it on Task 4.<br><br> 6. Check if the answer is correct and print to the console whether the answer is correct ot nor (Hint: write another method for this).<br><br> 7. Suppose this code would be a plugin for other programmers to use in their code. So make sure that all your code is private and doesn't interfere with the other programmers code (Hint: we learned a special technique to do exactly that). </p> |
| 14 | + <script src="app.js"></script> |
30 | 15 | </body>
|
31 | 16 |
|
32 | 17 | </html>
|
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
0 commit comments