Whenever I am coding, I often find myself every now and then in a REPL to test out some concepts before I go ahead and implement it. For Ruby on Rails development I use PRYand for python I use bpython. Wondering whether there is an equivalent for that in javascript. Basically testing out javascript code from the terminal
The REPL is an interactive environment that allows you to execute JavaScript code without first having to write it to a file. You can use the REPL to try out JavaScript code from other tutorials: How To Define Functions in JavaScript.
Yes, you can run JavaScript in your terminal. Now, when you enter a command into your terminal, there are generally options, also called switches or flags, that you can use to modify how the command runs.
Even though I usually have a JavaScript-enabled browser open, I often find myself using the Node.js REPL.
Just run node
in a command prompt, and it will open a REPL for you.
You just need to use node.js :
$ node
> 1 + 1
> 2
>
Although, this won't work for usual browser element (window
, document
) and DOM. If you want a browser environnement, checkout Phantomjs REPL and Casperjs - although I'm not sure about their capacity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With