Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Challenge Solution0:37 with Andrew Chalkley
Here's my solution to the Dice challenge.
Here's how I solved the problem.
I created a Dice constructor with one parameter of sides.
Next, I set the sides property on the instance that
gets created when the Dice constructor function gets called with the new keyword.
Finally, I added the roll method.
Down here, I created a new instance of a six-sided Dice.
And I can still use the roll method and it still works.
How did you do?
Did you get a similar solution to me?
You need to sign up for Treehouse in order to download course files.Sign up