简体   繁体   English

是否可以在vscode中运行选定的javascript代码?

[英]Is it possible to run selected javascript code in vscode?

Let say I want to see what is the value of this code, I want to run it. 假设我想看看这段代码的价值,我想运行它。 Can I select it and run that, and it would automatically import and execute all dependencies etc. 我可以选择它并运行它,它会自动导入并执行所有依赖项等。

VS Code is an editor , not a full IDE. VS Code是一个editor ,而不是完整的IDE。

By itself, it run any code. 它本身可以运行任何代码。

If you are writing for node.js , you may be able to call out to node and run things within a terminal window or, with the right plugin, turn on the debugger. 如果您正在编写node.js ,则可以在终端窗口中调出node并运行程序,或者使用合适的插件打开调试器。

If you are writing code for the browser, then no, you cannot fully run that code inside VS code. 如果要为浏览器编写代码,则不能,您无法在VS代码中完全运行该代码。 You might want to use a tool that will watch for changes and reload the browser window. 您可能想要使用一种工具来监视更改并重新加载浏览器窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM