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

TING-CHUN PAI
seal-mask
.a{fill-rule:evenodd;}techdegree
TING-CHUN PAI
Full Stack JavaScript Techdegree Student 3,312 Points

Is the calculation stops when it catches the 1st error?

The teacher commands 5 times to get 5 sets of random number. I thought he would get 3 random numbers and 2 error messages. But it doesn't run the rest of 3. Does the calculation stops when it finds its first error?

2 Answers

Steven Parker
Steven Parker
231,271 Points

It's normal for the script to stop running when it encounters an error, unless the script uses exception catching to handle the error itself (which this one does not).

It was told in the previous lectures, that javascript debug line by line, like it shows an error at a time, and when you remove it, it went to another and again shows error if there is.