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!

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

I am not finished yet. I am trying to figure out the challenge step by step

Here is my code so far. This code generates a number greater than the selected number by the User but greater than 1. I am having hard time creating math formula where the random number is between 1 and the selected number by the User. Any help would be appreciated.

var collectNumber1 = prompt('Choose your first number');

var randomNumber = Math.random();

var wholeNumber = Math.ceil(randomNumber) + parseInt(collectNumber1);


1 Answer