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, Part II Solution

Bryan Becker
Bryan Becker
8,849 Points

Error message isn't popping up

```function getRandomNumber ( lower, upper) { if ( isNaN (lower) || isNaN (upper) ) { throw new Error (' Both arguments must be numbers'); } return Math.floor(Math.random() * ( upper - lower + 1)) + lower; }

alert( getRandomNumber(5, 100) ); alert( getRandomNumber(5, 'twenty') ); alert( getRandomNumber('five', 50) );'''

I can't get the error message to pop up when entering a string.

Bryan Becker
Bryan Becker
8,849 Points

Also how do I make my code pop up as code in a screen rather then the copy and paste look?

Julian Gutierrez
Julian Gutierrez
19,201 Points

To format your code properly checkout the "Markdown Cheatsheet" located below the content box when writing/editing your post.

You can have pretty code with color coding if you start out with...

```javascript

Then on a new line, paste your code.

Finally, end with the following on another new line.

```

Try the "Markdown Cheatsheet" link for even more tips and tricks.

2 Answers

Julian Gutierrez
Julian Gutierrez
19,201 Points

I'm seeing the error on the console.

Bryan Becker
Bryan Becker
8,849 Points

Thank you for the help!