Anup Vasudeva
Anup Vasudeva

Reputation: 901

The offline version repl.it

Not sure if I am putting my question correctly - Is it possible to have an offline version of repl.it (only JavaScript required), so that it can be used without internet access?

Upvotes: 1

Views: 3190

Answers (4)

Ashutosh Bhadoria
Ashutosh Bhadoria

Reputation: 5

You can use RunJS. The free version can be used as a better REPL or an editor for testing small scripts. The paid version is worth it with extra themes, tabs and ability to import third party packages.

Upvotes: 0

Vinod Srivastav
Vinod Srivastav

Reputation: 4255

I wonder why can't you do to create your own REPL instead, you just have to create a new window.open("", "_Jres", "", "false") you can also have window.open("", "_self") to replace the current document.

<!DOCTYPE html>
<html>
<head><title>Js Execute</title></head>
<body>    
    <textarea id="code" rows="10" cols="50">
//write your code here
alert("Clicking OK will write heading 1 in the new window");
document.write("<h1>heading 1</h1>");
    </textarea>
    <br/>
    <button onclick="Execute()">Click To execute the above written JS</button>
    <script>
        function Execute() {
            var win2 = window.open("", "_Jres", "", "false");
            var content = document.getElementById("code");
            var datacode = content.value;
            console.log(datacode);
            var hbody = "<script>" + datacode + "</" + "script>";
            win2.document.writeln(hbody);
        }
    </script>
</body>
</html>

Upvotes: 0

Michiel van der Blonk
Michiel van der Blonk

Reputation: 720

If you have a text editor that can run a dos command, you can use CScript.exe, the windows version of a javascript engine. Though beware, that this is not ES5 compatible, and there is no browser object. Writing to stdout can be done using CScript.Echo()

I use TextPad which has a tools configuration, in which you can set the CScript path (find it in your windows system directory).

Upvotes: 0

SomeKittens
SomeKittens

Reputation: 39532

If you're looking to install a way to run a JavaScript REPL on your local machine, you have two options:

  • Open your browser's console as usual. Lack of internet doesn't make it any less JavaScripty.
  • Install NodeJS

Upvotes: 3

Related Questions