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 trialNayoon kim
3,098 Pointscan you enter a variable inside of the Math.random () <--- this parenthesis ?
like
Var input = prompt ('please type a number') ; var x = parseInt ( input); var y = Math.random (x) ; alert (y);
1 Answer
Steven Parker
231,271 PointsNo, Math.random() doesn't take an argument. It is typically multipled by a range and then an offset is added to set the maximum and minimum values of the random number.
For details, see this MDN documentation page.