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

Error within console

For the second 'Random number challenge' should the console refer you back to your own error message rather than the parts of the script that aren't a number?

https://w.trhou.se/aht7qi756o

The last part of your question is throwing me off but I'll try my best to answer based on how I understood the question. You will only receive the error message if the number meets the specific requirements of the conditional statement you have written it under: if ( isNaN(lower) || isNaN(upper) ) { throw new Error('You can do this'); } else { return Math.floor(Math.random() * (upper - lower + 1)) + lower; }

1 Answer

Steven Parker
Steven Parker
243,201 Points

I'm also not sure what you mean by "the parts of the script that aren't a number".

When I run this, what I see in the console is "Uncaught Error: You can do this", which is your own error message. Are you seeing something else?