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 trialGregory Ledger
6,116 PointsCode works in JS Bin , not in Chrome console
For the first random number function challenge: this is the code I have:
function randomNumber(top, bottom) { var eval = Math.floor(Math.random() * (top - bottom + 1)) + bottom; return eval; }
console.log(randomNumber(12, 6));
works fine in JS Bin, but I get "undefined" in the Chrome console
1 Answer
jacobproffer
24,604 PointsHey Gregory,
The reason you're seeing undefined in the console is because you're calling console.log within the console. Console.log doesn't return a value. You can simply call the randomNumber function.