As mentioned previously, JavaScript can also be debugged locally with Node.js. Node.js has it's own debugger that can be called using the inspect
keyword. Here's how you will debug a JavaScript file:
- Open Terminal/CMD
- Navigate to the folder of the file to debug
- Run
node inspect filename.js
- You will then see the debugging screen. This is what you will be using later. Type control c twice and exit the debugger.
- Go back to your JavaScript file and add the statement
debugger;
to create a breakpoint - Run step 3 again and a breakpoint will occur