Debug js in VS Code

Debug js in VS Code

Install two plugins first

  • debugger for chrome
  • The live server
    Insert picture description here
    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
Insert picture description here
Create the launch.json file
Insert picture description here
Environment select chrome to
Insert picture description here
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
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44048668/article/details/114745184