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 trialhugo folkesson
1,974 PointsI did it differently but will it still work the same way?
var rndNum = parseInt(prompt("Write a number (any)")); var rndNumTwo = parseInt(prompt("Write a number larger than the number you wrote before.")) var showNum = Math.floor(Math.random(rndNum) * rndNumTwo); alert(showNum);
1 Answer
Steven Parker
231,269 PointsThe program in the video will generate a number between (inclusive) the two numbers entered. But the different formula will get different results.
This one will generate a number from 0 up to (but not including) the second number. The first number is ignored entirely because the "random" function does not take an argument.
hugo folkesson
1,974 Pointshugo folkesson
1,974 PointsOh ok thank you! :)