Debug JS with VsCode


VsCode can debug JavaScript so that we can set break point and inspect values, instead of console.log

Here are the steps.
I use VsCode v1.30, Chrome v61, Windows 10.
VsCode is downloaded as zip file from code.visualstudio.com/download, no setup.exe
Run Code.exe and install MS Debugger for Chrome extension 4.11.3 there..
Create a VsCode project file: js.code-workspace, which tells where the .js .htm files are.
Create a launch file by click debug icon – gear icon.
Restart code.exe to have chrome listed in extension. Click it.
.\.vscode\launch.json which tells what browser and and the URL to run
e.g. http://localhost/VsCode/test.htm
Click debug button, or F5. code.exe launches chrome.
Break points can be set.
Variables can be checked by mouse over or in watch window.

Sample code can be downloaded here: http://riowing.net/p/VsCode.zip

VsCodeJs

Advertisements
Comments are closed.
%d bloggers like this: