Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrittney Scott
1,801 PointsRandom Array Index Project
Is there anything else I need to do? If so, can someone please tell me step my step. I'm so confused right now. Do I need to do anything else or is this all that is needed to complete project?
Here's the link to my workspace to view https://w.trhou.se/8db1m8mzz2
7 Answers
Steven Parker
231,271 PointsIt looks like you have a bit of work to do yet. The instructions 2, 2a, and 2b all talk about creating a new function named "diceRoll" but there's no function definition code (yet). The code that is there on lines 24-33 doesn't seem related to the instructions, and it makes reference to things like "player", "getRandomNumber" and "msg" that have not been defined (and probably are not needed).
The instruction comments break down the tasks into steps for you, try doing each one and focus on just what is being asked for at each step. There's also references to related videos if you need a refresher. But remember that while the videos cover the concepts, the actual examples shown in the video won't be exactly what is needed for these steps.
Brittney Scott
1,801 PointsSo are you saying to answer the questions in the order they are displayed and that is all?
Take a look at edited link: https://w.trhou.se/64zo7a9uno
Steven Parker
231,271 PointsSince the comments break things down in steps, then writing the code one step at a time might make it easier to focus on what needs to be done next and make things less confusing.
For example, looking just at step 2, what code would fit those instructions?
// 2) Create a function named diceRoll. Give it a parameter called array — this goes in the parens.
If you're not sure how to create a function you might want to review that video.
Brittney Scott
1,801 Pointsfunction diceRoll(array)
Steven Parker
231,271 PointsGood job! But you might want to include an open brace to start the function body.
Brittney Scott
1,801 PointsLike this:
{
function diceRoll(array)........
If all I need to do is answer the questions in the order as they are displayed then is that all that is required to complete this project?
Steven Parker
231,271 PointsThe brace to begin the body should come after the function definition.
The snapshot isn't working anymore (did you delete the workspace?), but when I saw it before it looked like all the steps needed had been provided in the comments.
Brittney Scott
1,801 PointsThank you lots!
Brittney Scott
1,801 PointsI am not sure. I will repost link below:
Steven Parker
231,271 PointsOh dear, that one doesn't work either. But perhaps you're good to go now.
Brittney Scott
1,801 PointsMy apologies. Try this one https://w.trhou.se/o2dhlnax8b
Steven Parker
231,271 PointsThat one's OK (for now), but I think you should be set to continue on at this point.
Happy coding!