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 trialLarissa 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...