Reading Journal
This topic is important because it allows you to break down your JS code and closely examine what it’s doing and how. It provides a closer look into the execution of the code while allowing you to start and stop the code at predetermined points. Being able to make edits to the code in a live environment is also helpful for troubleshooting.
Reading
What Went Wrong? Troubleshooting JavaScript.
1. Name some key differences between a Syntax Error and a Logic Error.
-
Syntax errors are caused when the code is thought to have been spelled correctly but something may be wrong with your spelling or a symbol may be incorrect. Syntax errors are generally easy to find due to an error code being thrown up at the place of failure.
-
Logic errors are caused by the code not actually delivering what the developer is trying to accomplish. The syntax is correct but the code itself is incorrect or logically incorrect. This is harder to locate due to there generally being no error code associated with the failure.
2. List a few types of errors that you have encountered in past lab assignments and explain how you were able to correct them.
- When writing up code, sometimes I’ll run into selector errors due. When this happens run the console function and look at the specific line of code that the error occurred on. Once located It’s generally pretty easy to spot what’s not working as intended. Syntax errors have been observed in the past too and most of the time it’s due to a missing semicolon. These are easy to spot on VSCode and just doing a quick skim will spot these errors pretty quickly.
3. How will this topic continue to influence your long term goals?
- I would imagine syntax or logic errors happen to even the most senior coders, therefore all I can do is take my time, build my skills and make sure to be intentional about what it is that I’m creating. Through good coding practices I can minimize the amount of errors I may create.
The JavaScript Debugger.
- The JavaScript Debugger tool is a really handy tool that lets you take a deeper look into your code. You’re able to set breakpoints into your code that lets you control when you want the code to stop executing. This allows you to walk step by step through your code to get a better understanding of what each function does and when. What’s even better is that you can make changes to your code through the debugger to see if it fixes your code or not.
2. Define what a breakpoint is.
- A break point is a user-defined stopping point within the debugger as it’s running the code. This allows you to analyze the program’s behavior and variables to ensure everything is running as designed.
3. What is the call stack?
- A call stack operates on a last in, first out basis and therefore deals with the current function that it’s on and finishes it to completion before moving onto the next function. It will run these functions until it’s finished, keeping track of what it’s done, thus allowing you to look back and see where the break is if there is one.
Things I want to know more about.
I’d like to gain more experience with hands on interaction with a debugger. I’ve used the standard “inspect” function and find that extremely useful, so I can only imagine how useful a JS debugger can be.