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 trialBen Mohammad
5,659 PointsWhat's wrong with my code??
Doesn't log to the console shows an error which i cant find i think im gradually geting better, gradually!!!
function getRandomNumber( lower, upper ){
Math.floor(Math.random() * (upper - lower + 1 ))+ lower;
} console.log(getRandomNumber( 2, 6)); console.log(getRandomNumber( 9, 5)); console.log(getRandomNumber( 4, 6));
1 Answer
Simon Coates
28,694 Pointsreturn Math.floor(Math.random() * (upper - lower + 1 ))+ lower;
you need to return something, so that the function call provides a value to the console.log method.
Ben Mohammad
5,659 PointsBen Mohammad
5,659 PointsGreat Simon thanks alot!!!