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
Joey Havia
4,948 PointsWhy i need an error message ? what is the goal of it ?
Want to understand the use of the error message ? why would i add a function to handle it ?
1 Answer
Daan Grootenboer
12,479 PointsAn error message helps you to find out what's the cause of the problem. So the goal of error messages is making debugging easier and faster.
For example..
try {
adddlert("Welcome!");
}
catch(err) {
console.log(err.message);
}
In this example you see immediately in the console that you typed the function "alert" wrong. This could save a lot of time because you don't have to search through the hole project to find cause of the problem.
This is a very simple example but i hope understand what i'm trying to say.