JavaScript

Run javascript from the command line

JavaScript is an extremely popular programming language and its use is not limited only to browsers. Fortunately, we can use JavaScript outside of web browsers, thanks to Node.js. Node.js is a version of Javascript that you can use outside of web browsers.
 

Installation of Node.js

Go to nodejs.org and follow the instructions depending on your platform.

If you are using Linux, run the following command:

user@stackhowto:~$ sudo apt-get install nodejs

 
Example: You can use the Node.js command prompt directly with the nodejs or node command. Write some javascript code (Ex: Hello, World!) And run it.

console.log("Hello, World!");

Now run the script like below:

user@stackhowto:~$ node hello.js
Hello, World!
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *