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 trialKelvin Parker
3,335 PointsCan anyone help me understand why this won't work?
I'm not sure if it's the code or the math I'm struggling with. If I change the inputs from prompts to just inputting the number it seems to stay within parameters. I've looked at several questions, working codes and want to try figure it out for myself rather than just watching the solution...
I've added the parseInt() which I forgot to add to change the string into a number, and added the missing semi-colon. Is this code right now? I'm riddled with self-doubt on this challenge!
UPDATED snapshot: https://w.trhou.se/qxsbti7bn3
1 Answer
KRIS NIKOLAISEN
54,971 PointsSee the final example on this page for the formula
Math.floor(Math.random() * (max - min + 1) ) + min;
Note: the final min is not included in the floor function