vscode中使用js的console配置 - mac

创建一个tasks文件:

使用快捷键 cmd + shift + b, 选择配置任务“,然后”从模板创建tasks.json文件“,然后从列表中选择”其他“。如果没有其他选项,就随便选一个。这样就创建了一个tasks.json文件啦
vscode中使用js的console配置 - mac_第1张图片

task.json文件配置

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "console",
        "type": "shell",
        "osx": {
          "command": "/usr/local/bin/node ${file}"
        },
        "linux": {
          "command": "/usr/bin/node ${file}"
        },
        "windows": {
          "command": "C:\\Program Files\\nodejs\\node.exe ${file}"
        },
        "group": {
          "kind": "build",
          "isDefault": true
        }
      }
    ]
  }

vscode中使用js的console配置 - mac_第2张图片
编辑之后保存即可。注意版本号,可能有些字段不支持了。

使用

保存后,选择一个js文件,使用快捷键cmd + shift + b,就可以看到js的console啦
vscode中使用js的console配置 - mac_第3张图片

你可能感兴趣的:(javascript,console)