Run JavaScript in Visual Studio Code

后端 未结 18 1081
北恋
北恋 2020-11-30 17:04

Is there a way to execute JavaScript and display the results using Visual Studio Code?

For example, a script file containing:

consol         


        
18条回答
  •  悲哀的现实
    2020-11-30 17:55

    For windows: just change file association of .js file to node.exe

    1) Take VSCode
    2) Right click on the file in left pane
    3) Click "Reveal in explorer" from context menu
    4) Right click on the file -> Select "Open with" -> Select "Choose another program"
    5) Check box "Always use this app to open .js file"
    6) Click "More apps" -> "Look for another app in PC"
    7) Navigate to node.js installation directory.(Default C:\Program Files\nodejs\node.exe"
    8) Click "Open" and you can just see cmd flashing
    9) Restart vscode and open the file -> Terminal Menu -> "Run active file".
    

提交回复
热议问题