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.


Hi, guys! Just found something interesting. The following works, but for there is no info show, no errors, but

function getRandomNumber( upper ) {
    var randomNumber = Math.floor( Math.random() * upper ) + 1; 
   return randomNumber;
console.log( getRandomNumber(6));
console.log( getRandomNumber(100));
console.log( getRandomNumber(655));
console.log( getRandomNumber(6888));

There are no errors, but the 200, does not show. I did fix the issue, when I realized I had put the console.log(getArea(10, 20)); in the wrong place. No errors, but no result. An issue with Chrome? Or just a thing with JS?

function getArea(width, length) {
var area = width * length;
return area;  
console.log(getArea(10, 20));  

Moderator edited: Markdown added so that code renders properly in the forums.

Steven Parker
Steven Parker
221,291 Points

Try putting your message after the title. The message got cut off after "but..."

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, and I applaud your willingness to play around with concepts you've learned. No, there are no errors and there is no output. Really, the problem here is the placement of your console.log(). Remember, once a function hits a return statement, it ceases execution. Also, your function is calling itself, which is called recursion and not really needed here. Simply moving the console.log() fixes this issue.

Take a look:

function getArea(width, length) {
var area = width * length;
return area;  // function will exit here

console.log(getArea(10,20));  // call the function passing in 10 and 20 and return the result which is then logged to the console

Hope this helps! :sparkles:

Thanks, Jennifer! :)