Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to open Node.js command prompt ?

  • Last Updated : 20 Aug, 2021

Node js help us to execute JavaScript code outside a web browser. It is neither a framework nor a programming language but basically a backend JavaScript runtime environment that helps to execute the scripts outside the browser. You can install node js from the web. You’ll be able to visit the link Download Node and download the latest version of the node in your machine. In this article, we will discuss how to open the node.js using a command prompt.

Installing Node.js on the machine: First of all, we have to check whether the node.js is installed on our machine or not. To check type “node –version” on the command prompt. If the installed version appears on the machine .Node.js is already installed on your machine otherwise we have to install the latest version of the node.js. Refer to this article to know the process of installing Node.js on your machine. 

How to open node js in command prompt: Node js comes with a virtual environment called REPL (READ, EVAL, PRINT, LOOP). It is a computer environment the same as command prompt and an easy way to test simple Node.js/JavaScript code and allows to execute multiple javascript codes. we can simply run REPL on the command prompt using node command on the command prompt.




Performing some operations on REPl:

  • Addition of the two numbers: We can add two numbers using “+” Operator.

  • Defining variables and assigning values to the variables: When you print the value or write some valid statements like defining variables etc it also returns undefined. JavaScript functions always return something therefore by default undefined is returned.

  • Execution for loop on REPL: We can execute for loop on the Node.js REPL in multiline same as in the javascript. This is called multiline expression.

 REPL commands:  These commands help to manipulate or communicate with the node.js commands on the REPL

.helpList out all the commands
Ctrl + CTo terminate the command
Ctrl + C {twice} / Ctrl + DTo exit the command prompt
TabDisplays all functions and objects.
.clearTo clear multi-lines expression

Executing REPL Commands:


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!