Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Larissa Röhrig
1,787 PointsWhat's wrong with my code?
There is no error but my code isn't working.
function getRandom ( upper, lower ) {
return Math.floor(Math.random() * (upper - lower + 1)) + lower;
}
console.log( getRandom(30,40) );
console.log ( getRandom(100,300) );
3 Answers

Ante Adamović
Front End Web Development Techdegree Student 2,508 PointsThe code is working, not sure why you say it's not.

Larissa Röhrig
1,787 PointsI don't know why but it didn't work in my console...

Erik Nuber
20,629 PointsWorks fine in the console

Larissa Röhrig
1,787 PointsI don't know why but it didn't work in my console...

Ed Bundy
5,408 PointsYour code didn't work for me in Safari 11.1.2 with javascript enabled in Safari Preferences. Nor did my own code. Alerts work fine, but not console.log. Had same problem with Chrome. Sorry, I have no answer as to why.
Karen Freeman-Smith
29,248 PointsKaren Freeman-Smith
29,248 PointsI don't see anything wrong, and it worked fine in my browser...