Now that we know what information we can get from an error stack trace, let’s take a look at an example.
Using this stack trace, let’s answer three questions you should ask yourself every time you want to debug an error:
<file path>/<file name>:<line number>. In this example, the location is
app.js:1. This means that the error was thrown in the file named
ReferenceError. We will discuss this error type in the next exercise.
myVariable is not defined.
You might notice in this example we skipped explaining a few lines in the stack trace and only included the beginning of the stack trace. A large part of debugging errors is recognizing which pieces of information are useful and which ones aren’t. For now, you will succeed by focusing on just the first and fifth lines of your error stack traces.
Near the beginning of the text file in the code editor, you will find an example stack trace. On line 14 of the text file, fill in the name of the file throwing the error in this stack trace.
If you are unsure how to fill in the answer, feel free to check out the hint.
On line 16 of the text file, fill in the line number throwing the error in the example stack trace.
On line 18 of the text file, fill in the type of the error being thrown in the example stack trace.
On line 20 of the text file, fill in the description of the error being thrown in the example stack trace.