2

I have to run a JavaScript file as an executable to show a dialog with standard buttons from command prompt. I am new to command line programming with java script.

3

2 Answers 2

5

Standard Javascript is not something that natively runs in a command line environment. It is designed for use in browsers. However, Node.JS is a framework built to give you this exact feature of running Javascript as a standalone.

It can be downloaded from http://nodejs.org and installed on most platforms.

Once you have it you can invoke your javascript file by running

$ node <your file name here>.js 
Sign up to request clarification or add additional context in comments.

Comments

1

You cannot run javascript from the command-line. Usually javascript is executed in a browser.
You can, however, use javascript from server-site (or command-line) using Nodejs.

Have a look here on how to achieve this: NodeJs
Or you can use the REPL (Read-Eval-Print-Loop): Repl

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.