Setting up the development environment

2 minute read


In this tutorial, we will guide you through the process of setting up a JavaScript development environment. By following these steps, you’ll be able to write, run, and test JavaScript code on your computer. Let’s get started!

Step 1: Install a Text Editor

A text editor is essential for writing JavaScript code. There are several options available, but for this tutorial, we recommend using Visual Studio Code. You can download it from the official website ( and follow the installation instructions for your operating system.

Step 2: Install Node.js

Node.js is a runtime environment that allows you to run JavaScript code outside of a web browser. It comes with a package manager called npm, which we will use later in this tutorial. Visit the Node.js website ( and download the LTS (Long-Term Support) version suitable for your operating system. Follow the installation instructions to install Node.js on your computer.

Step 3: Create a Project Folder

Choose a location on your computer where you want to store your JavaScript projects. Create a new folder for your project and give it a meaningful name. For example, you could create a folder called “my-javascript-project”.

Step 4: Open the Project Folder in Visual Studio Code

Open Visual Studio Code and go to “File” > “Open Folder”. Navigate to the project folder you created in the previous step and click “Open” to open it in Visual Studio Code.

Step 5: Create a JavaScript File

In Visual Studio Code, go to “File” > “New File” to create a new file. Save the file with a .js extension. For example, you could name it “script.js”. This will be the file where you write your JavaScript code.

Step 6: Write Your First JavaScript Code In the script.js file, you can start writing your JavaScript code. For example, you can write a simple “Hello, World!” program:

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

Step 7: Run Your JavaScript Code

To run your JavaScript code, open the integrated terminal in Visual Studio Code by going to “View” > “Terminal”. The terminal will open at the bottom of the window.

In the terminal, type the following command to run your script.js file:

node script.js

Press Enter, and you should see the output “Hello, World!” displayed in the terminal.

Step 8: Install External JavaScript Libraries

If your project requires the use of external JavaScript libraries or frameworks, you can install them using npm, the package manager that comes with Node.js. In the terminal, navigate to your project folder by using the 'cd' command. Once inside the project folder, you can run the following command to install a library named “example-library”:

npm install example-library

This command will download and install the “example-library” package into a folder called “node_modules” within your project folder.

Step 9: Use External JavaScript Libraries in Your Code

Once you have installed an external library, you can start using it in your JavaScript code. In your script.js file, add the following line at the top to import the “example-library” module:

const example = require("example-library");

You can now use the functions and features provided by the “example-library” in your code.

Step 10: Test Your JavaScript Code

Testing is an essential part of the development process. You can write test cases to ensure that your JavaScript code behaves as expected. There are various testing frameworks available for JavaScript, such as Jest and Mocha. You can install them using npm and follow their documentation to write and run tests!