简体   繁体   English

WebStorm 中普通 JavaScript 的最佳运行/调试配置

[英]Best Run/Debug Configuration for plain JavaScript in WebStorm

I am new to JavaScript but already know Python.我是 JavaScript 的新手,但已经知道 Python。 On https://onecompiler.com/javascript I can easily type JavaScript code such ashttps://onecompiler.com/javascript 上,我可以轻松输入 JavaScript 代码,例如

console.log("Hello World")

and it logs Hello World in the console.它会在控制台中记录 Hello World。

However, I recently installed WebStorm, but I don't know what Run/Debug Configuration I should choose to start with (I just want to type plain JavaScript):但是,我最近安装了 WebStorm,但我不知道我应该选择从什么运行/调试配置开始(我只想输入纯 JavaScript):

运行/调试配置

The image shows a list of configurations, however, none of them are called just JavaScript.该图显示了配置列表,但是,它们都没有被称为 JavaScript。 What should I choose to just type plain JavaScript and be able to run the code?我应该选择什么来输入普通的 JavaScript 并能够运行代码?

For plain javascript the right configuration is Node.js .对于普通的 javascript ,正确的配置是Node.js WebStorm auto-creates it for you when you right-click a .js file and choose Run or Debug .当您右键单击.js文件并选择RunDebug时,WebStorm 会自动为您创建它。

If you javaScript code is supposed to be run in browser, you need creating *.html file that will be used as your app entry point, link your javascript to this file with the <script> tag and then use either Run or Debug from .html file right-click menu - the corresponding JavaScript Debug run configuration will be created and started.如果您的 javaScript 代码应该在浏览器中运行,您需要创建*.html文件作为您的应用程序入口点,链接您的 javascript 文件,然后使用<script> Debug > 标签运行或使用 from.script .html文件右键菜单 - 将创建并启动相应的JavaScript 调试运行配置。

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

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