Run JavaScript in using Node. #JS-Shorts [8]

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the Chrome V8 engine and executes JavaScript code outside a web browser.

Run JavaScript in using Node. #JS-Shorts [8]

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the Chrome V8 engine and executes JavaScript code outside a web browser.

If you already have Nodejs in your system then confirm Node version.
(If you do not have Node or If you do not have Nodejs installed, Click here to see how to setup Node)

Confirm Node

Confirm Node installation on your machine by running following command in your terminal/command-prompt

 node --version

If not found follow this article for steps to install Node.

Next,

1. Open up your terminal/command-prompt and head over the project folder by running following command:

(If you haven't created a folder called js-node yet then please click on this link.)

Run this command: cd js-node

2. Run ls to check files inside the folder js-node. Make sure you have index.js and index.html

3. Now, to run JavaScript code in Node enter a command:

node index.js

We will get the same message "Hello World!" in the console that we get in the chrome browser-console (we have already seen this in previous article.)

  • Again, Node is a programme that uses Google's open source v8-JavaScript-Engine to execute/compile/run JavaScript code.
  • So, Node is a runtime environment to run JavaScript code.
  • See this video

Next,

Run JavaScript using Node in VSCode Terminal.

(Click here to know what is VSCode)

  • See this video

In this article we have covered:

To write JavaScript code using Nodejs outside and inside VS Code.


Next

Variables in JavaScript. #JS-Shorts [9]
Variables are used to store data temporarily in a computer’s memory.So, computer store data somewhere and give that a memory location and name...