Getting Started With JavaScript

JavaScript is a versatile, high-level programming language that is widely supported across all major operating systems.

To run JavaScript code, your system should have Node.js installed. Alternatively, you can use our free online editor to execute JavaScript directly in your browser without any installation.

For those who prefer to install JavaScript on your computer, this guide will walk you through the installation process on Windows, macOS, and Linux (Ubuntu).


Install JavaScript on Windows

To install JavaScript on your Windows, just follow these steps:

  1. Install VS Code
  2. Download Node msi file
  3. Install Node
  4. Verify your installation

Here is a detailed explanation of each of the steps:

Step 1: Install VS Code

Go to the VS Code Official website and download the Windows installer. Once the download is complete, run the installer and follow the installation process.

Click Finish to complete the installation process

Step 2: Download the Node File

Go to the official Node website and download the Node LTS version.

JavaScript Download Page
JavaScript Download Page

Step 3: Run the Installer

Now, go to your download folder and run the msi file you just downloaded. Depending on your security settings, you might be prompted to allow access. Just click on Next.

Simply allow it and proceed.

Then you will come across the install part.

Install JavaScript on Windows
Install JavaScript on Windows

Simply click on install, Node will be successfully installed in your device.

JavaScript Installation
JavaScript Installation

Step 4: Verify your installation

After the installation is complete, you can verify whether JavaScript is installed by using the following command in the command prompt.

node --version

JavaScript Installation Verification for Windows
JavaScript Installation Verification for Windows

Note: The version number might differ from the one above, depending on your installed version.

Now, you are all set to run JavaScript programs on your device.

Install JavaScript on macOS

To install JavaScript on your Mac OS, just follow these steps:

  1. Install VS Code
  2. Download Node.js Package
  3. Install Node.js
  4. Verify your installation

Here is a detailed explanation of each of the steps:

Step 1: Install VS Code

Go to the VS Code Official website and download the Mac installer. Once the download is complete, open the .dmg file and drag Visual Studio Code to your Applications folder.

Click Finish to complete the installation process

Step 2: Download the Node.js File

Go to the official Node website and download the Node LTS version.

JavaScript Download Page
JavaScript Download Page

Step 3: Run the Installer

Open the downloaded .pkg file and follow the on-screen instructions to install Node.js. You'll be guided through the installation process; just follow the prompts and agree to the license agreement.

Simply allow it and proceed.

Then you will come across the install part.

Install JavaScript on Mac
Install JavaScript on Mac

Simply click on install, Node will be successfully installed in your device.

JavaScript Installation
JavaScript Installation

Step 4: Verify your installation

After the installation is complete, you can verify whether JavaScript is installed by using the following command in the command prompt.

node --version

JavaScript Installation Verification for Mac
JavaScript Installation Verification for Mac

Note: The version number might differ from the one above, depending on your installed version.

Now, you are all set to run JavaScript programs on your device.

Install JavaScript on Linux

Linux has various distributions, and the installation process differs slightly from each other. The following installation process is based on the Ubuntu distribution.

You need Node to use JavaScript in your device. Follow these steps to install Node on your device.

  1. Install VS Code
  2. Install Node
  3. Verify your installation

Here is a detailed explanation of each of the steps:

Step 1: Install VS Code

Open the Terminal and type

sudo apt update 

This command updates your package lists to ensure you get the latest versions of your software.

Proceed to install VS Code with

sudo snap install code --classic 

Step 2: Install Node

Go to snapcraft and click install.

Go to Snapcraft
Go to Snapcraft

It will give you the command to install Node.

Get command
Get command

Open your Terminal and paste the command to install Node on your device.

sudo snap install node –classic

Wait until the installation finishes to start using Node.

JavaScript Installation for Linux
JavaScript Installation for Linux

Step 3: Verify your Installation

Once the installation is complete, you can verify whether Node is installed by using the following command in the Terminal.

node –version
JavaScript Installation Verification for Linux
JavaScript Installation Verification for Linux

Now, you are all set to run JavaScript programs on your device.

Run Your First JavaScript Program

First open VS Code, click on the File in the top menu and then select New File.

Create a New File in VS Code
Create a New File in VS Code

Then, save this file with a .js extension by clicking on File again, then Save As, and type your filename ending in .js. (Here, we are saving it as helloWorld.js).

Before you start coding, make sure the extension Code Runner is installed in VS Code. Open VS Code and click on Extensions on the left sidebar. Then, search for the Code Runner and click on install.

JavaScript Extension in VSCode
JavaScript Extension in VSCode

Now, write the following code into your helloWorld.js file:

console.log("Hello World")

Then click on the run button on the top right side of your screen.

JavaScript Run Program
JavaScript Run Program

You should see Hello World! printed to the output.

Now that you have set everything up to run JavaScript programs on your computer, you'll be learning how the basic program works in JavaScript in the next tutorial.


Video: JavaScript Getting Started

Did you find this article helpful?