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 trial
Jan Oberreiter
78,021 Pointsconsole just gives out Errors
I write this snippet:
function getRandomNumber( upper ) { var randomNumber = Math.floor( Math.random() * upper ) + 1; return randomNumber; }
console.log( getRandomNumber(6) ); console.log( getRandomNumber(100) ); console.log( getRandomNumber(10000) ); console.log( getRandomNumber(2) );
then, when I want to see the random numbers ... all that the console tells me is either nothing or a bunch of errors ... I uninstalled all my extensions ... but I just don`t get it to work? Can someone tell me, what is going wrong here? thank you very much, regards, Jan.
2 Answers
Vladut Astalos
11,246 PointsI wrote this and it worked without any errors:
function getRandomNumber(upper){
var randomNumber = Math.floor(Math.random() * upper) + 1;
return randomNumber;
}
Jan Oberreiter
78,021 Pointsthank you ... I use Safari now, there the console works fine, which it doesn`t in Chrome and Firefox ...