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 trialMark Del Mar
Courses Plus Student 5,167 PointsAdding a bit of text to the random number changes output range.
I got the random number generator to work (shows numbers from 1 to 6), however, I'm trying to add a bit of text to the alert. I'm getting numbers up to 30 now with no other change in Math.random.
alert("Your random number is " + Math.floor(Math.random() * 6) +1);
kayhen
3,504 Pointskayhen
3,504 PointsHi Mark,
You will need to add parentheses to the random calculation as per below, in order to isolate it:
alert("Your random number is " + (Math.floor(Math.random() * 6) +1))