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 Hello, JavaScript! Debug JavaScript in the Console

Console only shows one error at a time, from top to bottom—why?

Hello! I just wanted clarification for my notes. We learned that a computer/browser runs a JS program one command at a time, from top to bottom. Is this the reason that the errors in the Console only display one at a time? So the computer runs what it can of the program, but when it encounters an error, it stops and doesn't run further commands. You see this error logged in the Console.

Once the error is fixed, the computer begins running the program again until it encounters another error, then it stops executing and displays the next error until it is fixed, and so on.

I just want to make sure I'm understanding the reason behind the Console only showing one error at a time.

1 Answer

Steven Parker
Steven Parker
229,732 Points

Your understanding is exactly correct. Once an error occurs, the state of the program is no longer reliable; so if it continued to run, even properly written code would likely start reporting spurious errors.

All right, that's easy enough. Thank you!