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

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Random Number Challenge

Casey Catron
Casey Catron
1,831 Points

Keep me accountable please. How does this look?

http://codepen.io/ccatron/details/pJYNzX/

Please let me know your thoughts. Random number challenge from creating reusable code with functions 14 of 18. Working on getting better daily. Thanks for all your help!

1 Answer

It works!

Note that if you're using CodePen, you don't need the script tag in the HTML... in fact, since you're outputting to the console, you don't need any of the HTML, besides maybe the heading just so the user can see something.

Also, you might want to consider logging to the console a message that indicates the two numbers that were being used as the upper and lower limits being passed to the function, before each function call. That way the user can tell that the random number is indeed between the upper and lower limits.

The easiest way to do that is to copy the function call, put it inside quotes, and log that to the console:

console.log("getRandomNumber(100,60)");
console.log(getRandomNumber(100,60) );