是否有一个“即时窗口"?在Visual Studio Code中运行Javascript? [英] Is there an "immediate window" in Visual Studio Code to run Javascript?

查看:166
本文介绍了是否有一个“即时窗口"?在Visual Studio Code中运行Javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我一直在浏览器中使用F12来通过控制台测试Javascript代码段.我对此感到厌倦(无论如何此刻).

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).

我已阅读到在Visual Studio中,您可以使用即时窗口以交互方式运行Javascript.我想当我告诉我它在设计模式下无法评估时……恩,那是多么痛苦.

I've read that in Visual Studio you can use the immediate window to run Javascript interactively.. I've haven't tried it that hard. I think when I did it told me it can't evaluate while in design mode... ugh, what a pain.

我确实喜欢使用Visual Studio Code(历史上的崇高文本)有时只是弄乱代码片段的语法.如果我也可以快速在那儿也运行Javascript,那也很好.是否有可以在VSCode中下载的软件包来这样做?还是已经内置的东西?

I do like to use Visual Studio Code (sublime text historically) sometimes to just mess around with syntax of snippets. Would also be nice if I could just run Javascript there too quickly. Is there a package I could download in VSCode to do so? Or something already built in?

推荐答案

与VSCode中的Visual Studio不同,没有即时窗口.但是您仍然可以在VSCode中执行Javascript.

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

安装Code Runner扩展程序- https://marketplace.visualstudio.com/items?itemName = formulahendry.code-runner

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

在VSCode中打开JavaScript文件,然后使用快捷键 Ctrl + Alt + N ,代码将运行并显示输出在输出"窗口中.

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.

这篇关于是否有一个“即时窗口"?在Visual Studio Code中运行Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆