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 JavaScript Basics (Retired) Working With Numbers The Random Challenge Solution

2nd part of this challenge is not explained at all in this course!

I did the course 2 times in search of the 2nd challenge resolution, I found that we were not taught how to solve that part. Please let us know if we were not taught a challenge so we don't waste our time looking for the answer in the course. Thank you!

5 Answers

I believe the point of the second part of the challenge is to get you to start thinking on your own and finding answers on your own. That is why you did not find a step by step answer to it before the challenge. It encourages you to do research into the methods that we learned about. In the course, it was mentioned several times that the MDN is a resource to access when you have questions about different methods. If you go to that website and do a search for Math.random(), it will provide you with possible ways to start attacking the challenge problem. Specifically, you will find a section called: "Getting a random integer between two values, inclusive", which should be able to start you on the path to solving the second part of the challenge. Good luck!

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

It's possible Dave was demonstrating an alternative way to solve the problem. There's always more than one solution to a problem. The challenge requires you to use the folllowing JavaScript methods.

  • prompt() dialogue to collect user input
  • parseInt() function to convert the input to an integer
  • Math.random() method to create a random number

The rest is up to you. Good luck with the challenge! :-)

Lioz Elinger
Lioz Elinger
4,766 Points

You're right. it was very frustrating for me too

jack jones
jack jones
692 Points

i'm still having a problem with it if someone has an answer i would be glad to hear it.

Matthew Cramer
Matthew Cramer
1,075 Points

I was very disappointed/frustrated in it as well. Not nearly enough previous training/education to handle the challenge.