Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Start a free Basic trial
to watch this video
This is how I built my Question prototype.
-
0:00
In this video, I'll show you how I tackle the question prototype.
-
0:04
Here's my question.
-
0:06
I have a constructor function that takes in the text of the question and
-
0:12
array of choices and the correct answer.
-
0:15
The choices array has two items.
-
0:18
It has the correct answer and an incorrect answer.
-
0:22
I've also created a method on the question that checks
-
0:25
if the user's choice is the correct answer.
-
0:28
I chose to add a method here, rather than somewhere else in the code,
-
0:32
like in the quiz or the quiz UI, because the question should be the only object
-
0:37
that determines if an answer is correct or not.
-
0:41
How much did your implementation differ from mine?
-
0:44
If you did it differently, that's fine.
-
0:46
There's countless ways of solving a problem.
-
0:48
In the next video, I'll show you how I did my quiz prototype.
You need to sign up for Treehouse in order to download course files.
Sign up