Is there an “immediate window” in Visual Studio Code to run Javascript?

前端 未结 5 2095
予麋鹿
予麋鹿 2020-12-28 15:02

Yes, I use F12 in the browser all the time to test out Javascript snippets with the console. I\'m tired of that (for the moment anyway).

I\'ve read that in Visual St

相关标签:
5条回答
  • 2020-12-28 15:31

    This might do it: https://code.visualstudio.com/Docs/runtimes/nodejs

    Node.js is a platform for building fast and scalable server applications using JavaScript. Node.js is the runtime and NPM is the Package Manager for Node.js modules.

    To get started, install Node.js for your platform. The Node Package Manager is included in the Node distribution.

    0 讨论(0)
  • 2020-12-28 15:41

    There is no Immediate Window unlike Visual Studio in VSCode. But you can still execute Javascript in VSCode.

    Install the Code Runner Extension - https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner

    Open the JavaScript file in VSCode, then use shortcut Ctrl+Alt+N, the code will run and the output will be shown in the Output Window.

    0 讨论(0)
  • 2020-12-28 15:52

    I've found this extension that makes a scrathpad for JS, that runs at the same time as you are typing: https://quokkajs.com/

    Works on VS Code, Jet Brains, and Atom.

    0 讨论(0)
  • 2020-12-28 15:53

    Run the command node in the terminal below the editor, this will create a node environment where arbitrary JavaScript can be entered. You must first have node (and apparently npm) installed from nodejs.

    0 讨论(0)
  • 2020-12-28 15:56

    As of (at least) my current version of VS Code (1.5.2), the "Debug Console", while debugging, lets you run arbitrary JavaScript code as you would in the VS Immediate Window. (Similar to as you would for the Chrome Dev Tools Console.)

    0 讨论(0)
提交回复
热议问题