Debugging in Node Learning Goals
- Use the Node.js debugger
In this lesson we've learned about using the debugger built in to Node.js. To review, the process is as follows:
- Place one or more breakpoints in your code using the debugger keyword
- Run node inspect in the terminal to launch the debugger
- Run cont at the debug prompt to start execution of the code and advance to the first breakpoint
- Run repl at the debug prompt to enter the debugger's REPL
- Check the value of any variables by entering the variable name at the > prompt
- Exit the REPL using ctrl-C
- Continue stepping through the code using cont
- Run .exit or type ctrl-C twice to exit the debugger
Resources
W3schools - JavaScript Debugging
Difference between Node.js and Javascript
Errors and Stack Traces Learning Goals
- Recognize common JavaScript errors.
- Read a stack trace to discern where an error originated.
Resources
Uncaught ReferenceError: _____ is not defined (Links to an external site.)
Uncaught TypeError: _____ is not a function (Links to an external site.)
Uncaught SyntaxError: missing ) after argument list (Links to an external site.)
Uncaught TypeError: Assignment to constant variable.