javascript 找个工具可以在我的电脑上运行javascript

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8616654/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 03:59:52  来源:igfitidea点击:

Looking for a tool can run javascript in my computer

javascript

提问by Freewind

Sometimes I have to test some javascript code, that I use jsbin.com, but it's not always convenient.

有时我必须测试一些 javascript 代码,我使用jsbin.com,但这并不总是很方便。

I hope there is a GUI tool can let me run javascript in my computer. I paste some javascript code into it and click 'RUN', that it will show me result.

我希望有一个 GUI 工具可以让我在我的电脑上运行 javascript。我将一些 javascript 代码粘贴到其中并单击“运行”,它将显示结果。

Is there such a tool?

有这样的工具吗?



UPDATE

更新

If I use browser, I need to create a html file first, that's not convenient. I think what I want is a offline version of jsbin.com.

如果我使用浏览器,我需要先创建一个html文件,这不方便。我想我想要的是jsbin.com的离线版本。

采纳答案by manny

All Browser will support to run your javascript, and most of the browser has add-on or plugins to debug your script. Only you need a editor to create your js file

所有浏览器都将支持运行您的 javascript,并且大多数浏览器都有附加组件或插件来调试您的脚本。只有你需要一个编辑器来创建你的 js 文件

or

或者

you can use jsfiddle to test your code with multiple ajax framework.

您可以使用 jsfiddle 使用多个 ajax 框架测试您的代码。

回答by Alnitak

You only need two things:

你只需要两件事:

  • notepad.exe, or a similar text editor
  • a web browser
  • notepad.exe 或类似的文本编辑器
  • 网络浏览器

I expect you already have those... ;-)

我希望你已经有了那些...... ;-)

回答by Nikhil

I recently came across another option that maybe useful to you - Node.jsis a server side javascript engine that you can download and run on your local machine. It has a REPL mode if you invoke it without passing a javascript file to it. From this mode you can load javascript files directly and run them from the command line.

我最近遇到了另一个可能对您有用的选项 - Node.js是一个服务器端 javascript 引擎,您可以下载并在本地机器上运行。如果您在不向其传递 javascript 文件的情况下调用它,则它具有 REPL 模式。在这种模式下,您可以直接加载 javascript 文件并从命令行运行它们。

回答by Keith.Abramo

A lot of people on SO use www.jsfiddle.net. It lets you set up html, css and javascript as well as import external files to reference.

SO 上的很多人都使用 www.jsfiddle.net。它允许您设置 html、css 和 javascript 以及导入外部文件以供参考。

回答by Joe White

If you'd prefer to run JavaScript outside a browser, you could use node.js. It has an interactive console, which would probably be great for what you're looking for.

如果你更喜欢在浏览器之外运行 JavaScript,你可以使用node.js。它有一个交互式控制台,这可能非常适合您正在寻找的内容。

Or if you're on Windows, you can use wscript, which is included with Windows.

或者,如果您使用的是 Windows,则可以使用Windows 附带的wscript

回答by Nikhil

OK so you want to be able to code and run javascript directly without needed to call it in an HTML file and then load the file in your browser.

好的,所以您希望能够直接编码和运行 javascript,而无需在 HTML 文件中调用它,然后在浏览器中加载该文件。

If the code is a short snippet then as Yoshi has pointed out earlier - modern browsers like chrome and firefox with firebug (my favorite) allow you directly run JS snippets on the browser javascript console.

如果代码是一个简短的片段,那么正如 Yoshi 之前指出的那样 - 现代浏览器,如带有 firebug(我最喜欢的)的 chrome 和 firefox 允许您直接在浏览器 javascript 控制台上运行 JS 片段。

This may be a little more tedious for larger scripts, so I think you should look for a javascript IDE which will give some debugging options as well. Have a look at the Cloud9 IDE- it is available as a chrome plugin and is essentially an IDE in the cloud, but it has an offline mode you can use when you are disconnected. It is based on an open source AJAX code editor called ACE. You can see some of the capabilities in these screencasts.

对于较大的脚本,这可能有点乏味,所以我认为您应该寻找一个 javascript IDE,它也会提供一些调试选项。看看Cloud9 IDE- 它可作为 chrome 插件使用,本质上是云中的 IDE,但它具有离线模式,您可以在断开连接时使用。它基于名为ACE 的开源 AJAX 代码编辑器。您可以在这些截屏视频中看到一些功能。