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 trial

JavaScript

Random 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
Steven Parker
231,153 Points

It 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.

So 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
Steven Parker
231,153 Points

Since 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.

function diceRoll(array)

Steven Parker
Steven Parker
231,153 Points

Good job! :+1: But you might want to include an open brace to start the function body.

Like 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
Steven Parker
231,153 Points

The 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.

Thank you lots!

I am not sure. I will repost link below:

https://w.trhou.se/y4upnehvj0

Steven Parker
Steven Parker
231,153 Points

Oh dear, that one doesn't work either. But perhaps you're good to go now.

My apologies. Try this one https://w.trhou.se/o2dhlnax8b

Steven Parker
Steven Parker
231,153 Points

That one's OK (for now), but I think you should be set to continue on at this point.
Happy coding!