reading-notes

Debugging

Troubleshooting our code.

Troubleshoorting JavaScript

Name some key differences between a Syntax Error and a Logic Error.

Syntax errors can be thought of a typos and the program running your code simply won’t understand what you’re trying to say. Logic errors are like sending your partner a well-crafted apology note, but you kinda missed the point and get in more trouble. The code is capable of being processed, but you are not getting the output you intended.

List a few types of errors that you have encountered in past lab assignments and explain how you were able to correct them.

*Lots of syntax errors. Sometimes the console picks them up, and displays a syntax error, which is an easy fix. ChatGPT has caught a few other syntax errors that the console missed because it was able to return null (I think). Variables being not defined has come up a bunch, either because of a syntax error or maybe because I tried to call for information that wasn’t yet filled by a funciton that hadn’t run yet because of the order of my code. Also, trying to load a page that links to a JS file, which referenced an ID tag on a different page broke me for awhile.. I think this was another “not defined” type of error.

How will this topic continue to influence your long term goals?

Understanding error codes is crucial to identifying and fixing bugs expediently.

The JavaScript Debugger

How would you describe the JavaScript Debugger tool and how it works to someone just starting out in software development?

The JS debugger allows you as the dev to pause and inspect what’s going on as your JS runs. I imagine this is particularly powerful when variables are being created/reassigned, and when pushing into objects or arrays.

Define what a breakpoint is.

A breakpoint is a line of code you designate to pause JS from running so you can more closely examine what’s happening in your program and verify it’s doing what you intend.

What is the call stack?

The call stack displays the code that had been executed up to the line you are viewing.

Things I want to know more about

The Chrome console is helpful for debugging, but I’d like to look more into these JS debugger features… I really like the idea of a breakpoints to get a better view of what is actually working or not working before I run the whole thing.