Debugging
Syntax errors: These are spelling errors in your code that actually cause the program not to run at all, or stop working part way through — you will usually be provided with some error messages too. These are usually okay to fix, as long as you are familiar with the right tools and know what the error messages mean!
Logic errors: These are errors where the syntax is actually correct but the code is not what you intended it to be, meaning that program runs successfully but gives incorrect results. These are often harder to fix than syntax errors, as there usually isn’t an error message to direct you to the source of the error.
What Went Wrong? Troubleshooting JavaScript.
(reference: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_went_wrong)
Questions
- Name some key differences between a Syntax Error and a Logic Error.
Syntax- misspelling of words to get certain function invoked
Logic- words are spelled correctly invoked unintented function
- List a few types of errors that you have encountered in past lab assignments and explain how you were able to correct them.
Not keeping track of variable names, camelcasing, and curly brackets being left open or closed. They all affect how a funnction is invoked and the scope of set function
- How will this topic continue to influence your long term goals?
For the rest of my career as a developer, I will continue to create logic and more often than not, syntax errors. Capitalization and curly brackets where they start and end will be my downfall.
The JavaScript Debugger.
every modern site has an inspection option when right clicked and allow you to view code split up by CSS , HTML and JS on most occassions, F12 for windows
ctrl shft s to open js debugger tool
(reference: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools#the_javascript_debugger)
Questions
- How would you describe the JavaScript Debugger tool and how it works to someone just starting out in software development?
it’s like a magnifying glass for the code used on a live site, the debugger will allow you to see where the JS code is ran and where, as well as the scope of the function being invoked
- Define what a breakpoint is.
breakpoint- is where you wish the JS code to stop running
- What is the call stack?
call stack- shows you what code was executed to get to the current line
Things I want to know more about
- different type of debugger tools
- young developer tricks to avoid syntax and logic errors