From the course: Learning Visual Studio Code

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Using the built-in Node.js debugger

Using the built-in Node.js debugger - Visual Studio Code Tutorial

From the course: Learning Visual Studio Code

Using the built-in Node.js debugger

Nobody's code works the first time all the time. Learning to use a debugger to find problems in your code is part of a developer's job, and being able to debug your code right in the editor you're using to write it is very convenient. VS Code includes a built-in debugger with debugging support for Node.js. With it, you can debug JavaScript, TypeScript, and any language that transpiles to JavaScript. You can also install debugger extensions for lots of other languages. Let me show you a couple of ways you can get started with the built-in debugger. I'll first open the menus.js file from the scripts folder in my project. You can add breakpoints to a code file by clicking in the far left margin on the line where you want the code to pause. I'll add one on Line 8 of this file. Since the index.htm file is the home page for the site, I'll open it so we can run and debug from there. I'll now click the "Run and Debug" button on the activity bar. From here, I'll click the "Run and Debug"…

Contents