在VS Code中调试js

在VS Code中调试js

先安装两个插件

  • debugger for chrome
  • live server
    在这里插入图片描述
    创建一个index.html文件,创建一个index.js文件
    在index.html中引入index.js文件

在index.js文件中打断点
在这里插入图片描述
创建launch.json文件
在这里插入图片描述
环境选择chrome
在这里插入图片描述
修改launch.json如下

{
    // 使用 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}"
        }
    ]
}

点击调试即可
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44048668/article/details/114745184