Set Up Your Editor and Course Folder

In the previous lesson, you saw that a program is a list of exact instructions, and that the text of those instructions, the source code, is something you write first and run later. Before you can run anything, your source code needs a home on your computer, and this lesson sets one up.

By the end, you’ll have a code editor installed, a course folder opened in it, and a first file saved inside, which you’ll also find outside the editor by its full name. Every program in this course will live in this folder, so it’s worth getting right once.

Plan for about twenty minutes. You can stop after any step and resume later.

Use a Code Editor for Your Source Code

Source code is plain text, meaning letters, digits, quotes, brackets, and spaces with nothing else attached. JavaScript reads that text character by character, as literally as the helper from the previous lesson.

That’s why a word processor such as Word or Pages is the wrong tool. It quietly turns a straight quote (") into a curly one (“ or ”), and it saves your words in a document format like .docx, wrapped in fonts, page sizes, and other formatting. JavaScript expects straight quotes and plain text, so a file written there won’t run.

Notes apps often curl quotes too, and many don’t save a separate file you can name and find.

A code editor is a program for writing plain-text files. It saves exactly what you type, with no formatting added and no quotes swapped for curly ones, and it lets you choose the exact filename. In this course, you’ll use Visual Studio Code, usually called VS Code. It’s free and works the same way on Windows, macOS, and Linux.

A plain-text editor like Notepad works too, but with VS Code, every step here matches your screen. The optional button below opens a chat with the course mentor, with a question ready to send.

Install VS Code

Download VS Code for your system from its official site, code.visualstudio.com. The default install options are fine.

  • Windows: Run the installer and click through it with the options already selected.
  • macOS: Open the downloaded file, then drag Visual Studio Code into your Applications folder.
  • Linux: Download the package for your version of Linux, such as .deb for Ubuntu, and open it to install.

Once it’s installed, start VS Code. You can close the Welcome tab it shows, because you’ll work from a folder instead.

Create and Open Your Course Folder

A course folder holds everything you write in this course. Keeping it all in one known place means you, VS Code, and later the tools that run your code always look in the same spot. Yours will be js-course, with a scratch folder inside for small practice files.

You can create the folder and open it in one go.

  1. In VS Code, choose File → Open Folder.
  2. In the window that appears, go to your Documents folder.
  3. Click New Folder, name it js-course, and press Enter.
  4. Select js-course and click Select Folder on Windows or Open on macOS and Linux.

VS Code now asks, “Do you trust the authors of the files in this folder?” It protects you when opening a folder someone else made. You created this one, so click Yes, I trust the authors.

The name JS-COURSE now appears at the top of the Explorer panel on the left, which lists the folder’s contents: nothing yet. If you don’t see the panel, choose View → Explorer.

Create Files From the Editor

You could make new files in File Explorer or Finder, but those often hide the end of a file’s name. Create a text document there, name it welcome.js, and its real name might be welcome.js.txt. It looks right to you, but a tool that searches for welcome.js won’t find it.

When you create files from VS Code’s Explorer panel, the name you type is the whole name.

Start with the scratch folder.

  1. Move your mouse over JS-COURSE in the Explorer panel to show a few small icons.
  2. Click the New Folder icon, type scratch, and press Enter.

Next, create a file inside scratch: click the folder once to select it, then click the New File icon. Type welcome.js and press Enter. The .js at the end is the file’s extension, the part of a filename that tells your computer and VS Code what kind of file it is: here, JavaScript.

VS Code opens the empty file in a tab. Type this one line into it, exactly as shown.

Language: JavaScript Filename: scratch/welcome.js
console.log("My course folder is ready!");

This JavaScript instruction shows a message, and you’ll run lines like it soon. For now, notice that VS Code colors parts of the line because it reads the text as code, and that the quotes stay straight. VS Code may also add a closing quote or bracket as you type. Keep typing, and it steps over the one it added.

Save Your File and Know When It’s Saved

Look at the welcome.js tab. Next to the name, where a small × usually sits, there’s now a filled dot. That unsaved dot means the text in the editor has changes that aren’t in the file on your disk yet.

Save the file with File → Save, or press Ctrl+S on Windows and Linux, or Cmd+S on macOS. The dot turns back into the ×, and your line is now in the file.

When you run a program later, the computer reads the saved file, not your screen. If the dot is still there, it reads an older version. So when a change seems to have no effect, check the tab first.

VS Code also has an Auto Save setting in the File menu. This setting saves your file shortly after you stop typing. It’s off by default. Leave it off for now so saving stays a visible step, and switch it on once checking the dot is a habit.

Find Your File Outside the Editor

Your file is a real file on your computer, not something that lives only inside VS Code. To see it, right-click welcome.js in the Explorer panel and choose the option for your system.

  • Windows: Reveal in File Explorer
  • macOS: Reveal in Finder
  • Linux: Open Containing Folder

A window opens on your scratch folder inside js-course. Before you trust that name, make sure your system shows extensions, even if the filename already reads welcome.js. A hidden extension can make welcome.js.txt look like welcome.js.

  • Windows 11: In File Explorer, choose View → Show → File name extensions.
  • Windows 10: In File Explorer, open the View tab and check File name extensions.
  • macOS: In Finder, choose Finder → Settings, open Advanced, and check Show all filename extensions.
  • Linux: File managers usually show full names. To confirm, check the name under right-click → Properties.

With that setting on, your file’s name should read welcome.js. If you ever spot a welcome.js.txt, right-click it in VS Code’s Explorer panel and choose Rename. The button below asks the mentor to walk you through it.

Check Your Setup

Answer these in your own words before reading on, as if explaining them to a friend starting this course.

  1. Why shouldn’t you write your code in Word, Pages, or a notes app?
  2. Why create files from VS Code’s Explorer panel instead of from File Explorer or Finder?
  3. How can you tell whether welcome.js is saved and what its real name is?

Here’s what your answers might include. A word processor curls quotes and adds formatting JavaScript can’t read, while a code editor saves plain text. VS Code creates files with exactly the name you typed. And a dot on the tab means unsaved changes, while File Explorer or Finder, with extensions showing, tells you the full name.

To check the hands-on part, quit VS Code completely and start it again. If it doesn’t reopen your folder by itself, choose File → Open Folder and select js-course once more. You should see scratch and welcome.js in the Explorer panel, with your line still inside.

Also check that the welcome.js tab shows no unsaved dot. VS Code can restore unsaved text after a restart, so seeing your line isn’t proof on its own. No dot means the line is in the saved file. This is how you’ll pick up each time you come back.

Your editor, your folder, and your first saved file are all in place. In the next lesson, Open the Terminal and Check Node, you’ll open a terminal in VS Code, right in this folder, and check that your computer can run JavaScript.

Become a Member to join the conversation.