mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 10:00:39 -04:00
fix(curriculum): Clarify quiz game instructions and tests (#59355)
Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@ Fulfill the user stories below and get all the tests to pass to complete the lab
|
||||
1. The `answer` key should have the value of a string, representing the correct answer to the question. Also, the value of `answer` should be included in the `choices` array.
|
||||
1. You should have a function named `getRandomQuestion` that takes an array of questions as a parameter and returns a random question object from the array.
|
||||
1. You should have a function named `getRandomComputerChoice` that takes the array of the available choices as a parameter, and returns a random answer to the selected question.
|
||||
1. You should have a function named `getResults` that takes the selected question object and the computer choice as its parameters and returns `The computer's choice is correct!` if the answer is correct. Otherwise, it returns `The computer's choice is wrong. The correct answer is: <correct-answer>`, where `<correct-answer>` is the value of the correct answer to the chosen question.
|
||||
1. You should have a function named `getResults` that takes the question object as the first parameter and the computer's choice as the second parameter. The function should return `The computer's choice is correct!` if the answer is correct. Otherwise, it returns `The computer's choice is wrong. The correct answer is: <correct-answer>`, where `<correct-answer>` is the value of the correct answer to the chosen question.
|
||||
|
||||
# --hints--
|
||||
|
||||
@@ -108,6 +108,13 @@ You should have a function named `getResults`.
|
||||
assert.isFunction(getResults);
|
||||
```
|
||||
|
||||
Your `getResults` function should take the question object as the first parameter and the computer's choice as the second parameter.
|
||||
|
||||
```js
|
||||
assert.equal(getResults(questions[0], questions[0].answer), `The computer's choice is correct!`);
|
||||
assert.notEqual(getResults(questions[0].answer, questions[0]), `The computer's choice is correct!`);
|
||||
```
|
||||
|
||||
If the computer choice matches the answer, `getResults` should return `The computer's choice is correct!`
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user