Debug js in VS Code
Install two plugins first
- debugger for chrome
- The live server
creates an index.html file, creates an index.js file
, and introduces the index.js file into index.html
Break the break point in the index.js file
Create the launch.json file
Environment select chrome to
modify launch.json as follows
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "chrome 调试",
"url": "http://localhost:5500",
"webRoot": "${workspaceFolder}"
}
]
}
Click to debug