I’m reading books on JavaScript programming, and I need an environment like Python’s IDLE to type JavaScript commands into and then see the results like you would in IDLE.
Is there an environment where you can do such a thing?
Any of the major browsers (IE, FireFox, Chrome, Safari, etc..) will execute and display the results of JavaScript code that you put into it.
You can open the developer console in Chrome and in IE using F12 and in Firefox using Ctrl+Shift+K. Alternatively you can simply put it into a .html
file.
1
I find http://jsfiddle.net/ to be a good test environment for trying things out (in JavaScript, HTML and CSS), if you just want to try something easily and now using your browser.
1
Mainstream browsers’ dev tools have a console for executing expressions:
- Evaluating Expressions in Google Chrome.
- The Internet Explorer F12 tools console.
- The Firefox Console.
See also Plunker. It is similar to the already mentioned jsFiddle.
2
Most of the answers centre on JavaScript code in the web browser. If you’re interested in server-side JavaScript code (or more generally, JavaScript code in non-browser environments), then you’ve got a couple of other options:
- Node.js is currently the most popular server-side JavaScript framework and comes with an interactive console. Once you’ve installed Node.js, you can start the console either from the Start Menu, or by typing
node
into a terminal. - There’s also a reasonable amount of buzz about Nashorn, which is bundled with Java 8. Once you’ve installed JDK 8, you can start the console by running
jjs
, which depending on your OS will either be available automatically from the terminal, or found at$JAVA_HOME/bin/jjs
.
As for actual IDE’s, you could use Visual Studio (express version is free). They’ve added better JS intellisense support in the past few releases.
Jetbrains Webstorm is an IDE you can use as well, if that’s the sort of thing you’re looking into.
Otherwise, there’s probably an eclipse plugin.
There’s also Sublime Text and Atom, that, with a few plugins, can do it very well.