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 Functions Arrow Functions Testing for Number Arguments

Jasper Kop
Jasper Kop
10,423 Points

when I program it my self I don't get the regular error.I do see the text Both arguments must be numbers.

function randomnr(lower=3, upper=5) { if( isNaN(lower) || isNaN(upper)){ console.log('Both arguments must be numbers.');} return Math.floor(Math.random() * (upper - lower + 1)) + lower; }

// Call the function and pass it different values

console.log(randomnr(1,'six')); console.log(${randomnr(10,100)} is a random number between two numbers); console.log(randomnr(200,500)); console.log(randomnr(5,7)); console.log(randomnr());

2 Answers

Steven Parker
Steven Parker
229,744 Points

The message will look different when using "console.log" (as shown above) instead of "throw" (as done in the video).

So it sounds like what you see is correct given the changes you have made in the code.

Jasper Kop
Jasper Kop
10,423 Points

Thanks!!! I totally missed this part