easy
NodeJS Easy​
What is NodeJS?
Node.js is a special environment that lets you run JavaScript code outside of web browsers.
NodeJS is a cross-platform and opensource Javascript runtime environment that allows the javascript to be run on the server-side.
Nodejs allows Javascript code to execute outside the browser. Nodejs comes with a lot of modules and mostly used in web development.
Node.js use V8 engine as its core, which means your JavaScript code can run run quickly and smoothly, even outside of a browser.
How to run a JavaScript file using NodeJS?
Install Node.js
: If you don’t have Node.js installed firstly on your system
Create a JavaScript file
: For example, let's create a file named index.js
and open it in any text editor like Visual Studio Code or Sublime and write some code e.g
console.log("Hello World!");
Run the File
: Once you’re in the directory, type the following command in the terminal node index.js
This will execute the JavaScript code in the index.js file, and the output Hello, World!
will be displayed in the terminal.
How to check the version of NodeJS?
To check your version of Node.js
, just typenode -v
in terminal.
Output:
v18.17.1