Lesson guide
Learning objectives
- Explain the main purpose of Code editors in JavaScript.
- Identify the syntax, APIs, or concepts introduced in this lesson.
- Use the examples to predict how JavaScript will behave before you run similar code.
- Connect this topic to nearby lessons in An introduction.
Real-world context
This lesson matters when you need to recognize where Code editors fits into real JavaScript programs. A code editor is the place where programmers spend most of their time.
Key ideas
- Code editors is part of the An introduction chapter, so it builds on the surrounding concepts rather than standing alone.
- Read each code example in two passes: first for the result, then for the rule that explains the result.
- When a section compares similar features, focus on the condition that makes you choose one feature over another.
Key terms
- Code editors
- Code
- editors
- An introduction
- JavaScript
A code editor is the place where programmers spend most of their time.
There are two main types of code editors: IDEs and lightweight editors. Many people use one tool of each type.
IDE
The term IDE (Integrated Development Environment) refers to a powerful editor with many features that usually operates on a “whole project.” As the name suggests, it’s not just an editor, but a full-scale “development environment.”
An IDE loads the project (which can be many files), allows navigation between files, provides autocompletion based on the whole project (not just the open file), and integrates with a version management system (like git), a testing environment, and other “project-level” stuff.
If you haven’t selected an IDE yet, consider the following options:
- Visual Studio Code (cross-platform, free).
- WebStorm (cross-platform, paid).
For Windows, there’s also “Visual Studio”, not to be confused with “Visual Studio Code”. “Visual Studio” is a paid and mighty Windows-only editor, well-suited for the .NET platform. It’s also good at JavaScript. There’s also a free version Visual Studio Community.
Many IDEs are paid, but have a trial period. Their cost is usually negligible compared to a qualified developer’s salary, so just choose the best one for you.
Lightweight editors
“Lightweight editors” are not as powerful as IDEs, but they’re fast, elegant and simple.
They are mainly used to open and edit a file instantly.
The main difference between a “lightweight editor” and an “IDE” is that an IDE works on a project-level, so it loads much more data on start, analyzes the project structure if needed and so on. A lightweight editor is much faster if we need only one file.
In practice, lightweight editors may have a lot of plugins including directory-level syntax analyzers and autocompleters, so there’s no strict border between a lightweight editor and an IDE.
There are many options, for instance:
- Sublime Text (cross-platform, shareware).
- Notepad++ (Windows, free).
- Vim and Emacs are also cool if you know how to use them.
Let’s not argue
The editors in the lists above are those that either I or my friends whom I consider good developers have been using for a long time and are happy with.
There are other great editors in our big world. Please choose the one you like the most.
The choice of an editor, like any other tool, is individual and depends on your projects, habits, and personal preferences.
The author’s personal opinion:
- I’d use Visual Studio Code if I develop mostly frontend.
- Otherwise, if it’s mostly another language/platform and partially frontend, then consider other editors, such as XCode (Mac), Visual Studio (Windows) or Jetbrains family (Webstorm, PHPStorm, RubyMine etc, depending on the language).
Common mistakes
- Skipping the small examples and then missing the exact rule that Code editors depends on.
- Copying code without changing one value at a time to see which part controls the result.
- Treating similar-looking syntax or APIs as interchangeable before checking their edge cases.
Active code check
Predict
Predict the exact string this editor-themed example logs, including the colon.
Reveal explanation
The sample uses two constants and a template literal. Good editor support makes this kind of small feedback loop easier because names and punctuation are visible while you type.
Try it
Change editor to the editor you use and change habit to one workflow habit you want to practice.
Summary
- Code editors gives you one more piece of the JavaScript mental model.
- The examples in this lesson are the quickest way to check whether the rule is clear.
- Revisit the key terms when you meet the same idea in later chapters.
Practice
- Rewrite one example from this lesson without looking at the original, then run it and compare the result.
- Change one input, operator, method call, or option in a code sample and predict what will happen before running it.
- Explain Code editors in your own words as if you were reviewing it with another learner.
Keep learning
Continue with Developer console when you are ready for the next lesson.