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 trialZack White
1,387 Pointsthis wont work for some reason
function getNumber (lower, upper) { return Math.floor(Math.random () * (upper - lower + 1 )) + lower; }
console.log(getNumber(23,9));
6 Answers
Seth Kroger
56,413 PointsThe way you've defined the function, the lower number is supposed to come first, then the upper. So you should be writing console.log(getNumber(9, 23));
Zack White
1,387 Pointsunfortunately that didn't change anything...
Steven Parker
231,271 PointsIt seems to work great once you put the parameters in the right order. What makes you think it's not?
Zack White
1,387 Pointsits not showing random numbers in my console
Zack White
1,387 Pointsok so I tried firefox and it worked.... thanks!!!
Zack White
1,387 PointsThis is annoying. It only shows one result
function getNumber (lower, upper) { return Math.floor(Math.random () * (upper - lower + 1 )) + lower; }
document.write(getNumber(9,23)); document.write(getNumber(5,42)); document.write(getNumber(1,2421)); document.write(getNumber(25, 5));