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
Nathan Ayala
5,246 Pointshow does the number in getRandomNumber(###); work? Why is it multiplying it by the number?
Im use to doing this the first way it is written, im not entirely sure how the getRandomNumber(6); is the same thing? When you place an integer into the parenthesis is it automatically multiplied and why?
function getRandomNumber( upper ) { var randomNumber = Math.floor( Math.random() * 6 ) + 1; return randomNumber; }
console.log(getRandomNumber());
function getRandomNumber( upper ) { var randomNumber = Math.floor( Math.random() * upper ) + 1; return randomNumber; }
console.log(getRandomNumber(6));
2 Answers

Piotr Manczak
Front End Web Development Techdegree Graduate 25,171 PointsIt is some sort of witchcraft if you ask me.

Piotr Manczak
Front End Web Development Techdegree Graduate 25,171 PointsDon't look in the bible. Try documentation on https://developer.mozilla.org/en-US/. All the answers are there. As a professional front-end developer you will be spending approx 80% looking through the documentation so you can get use to right now.
Nathan Ayala
5,246 PointsNathan Ayala
5,246 Pointscurrently searching the bible for the answer