To set up VS Code for JavaScript development, install Visual Studio Code, open a project folder, and add a few extensions and settings: ESLint for finding mistakes, Prettier for formatting, and optionally a live preview. VS Code already understands JavaScript out of the box through its built-in language support, with syntax colouring, autocomplete and error hints.
This article walks through a minimal setup that is enough for everyday work, and explains what each part does so you can change it later. The search phrase most people use is vs code javascript setup.
js-course.Always work in a folder instead of opening single files. VS Code uses the folder to find settings, extensions and project configuration. If you also installed Node.js, you can open a terminal inside the editor with the Ctrl and backtick shortcut.
The editor ships with a JavaScript language service, so you already have:
Create a file named hello.js and type con. The editor suggests console, then lists its methods.
Open the Extensions view with Ctrl+Shift+X and search by name.
| Extension | Purpose |
|---|---|
| ESLint | Reports likely bugs and style problems while you type |
| Prettier - Code formatter | Formats code automatically so it looks consistent |
| Live Server or Live Preview | Serves an HTML page and reloads when you save |
| Error Lens (optional) | Shows error messages at the end of the line |
Install only what you need. Each extension adds startup time and settings you have to understand.
After you install Prettier, open Settings (Ctrl+,) and turn on these options, or put them in .vscode/settings.json inside your folder:
Now every time you save, the file is reformatted. Keeping settings in the project folder also means everyone who opens the project gets the same behaviour.
ESLint needs a project with Node.js and npm. In the terminal:
The second command asks a few questions and creates eslint.config.js, the flat config file that current ESLint versions use. With the extension installed, VS Code underlines problems such as unused variables:
The editor marks unused as assigned but never used. Fix it or delete it.
You can run a file in three ways:
node hello.js in the integrated terminal.To debug, click in the gutter next to a line number to set a breakpoint, then press F5. Execution stops on that line and you can inspect variables and step through the code.
Settings in .vscode/settings.json apply only to that folder, so you can share them with a team through version control. Add a .prettierrc file for formatting rules such as quote style, and keep eslint.config.js in the project root.
Two more habits help beginners. Use the Problems panel (Ctrl+Shift+M) to see every warning in one list, and use the Command Palette (Ctrl+Shift+P) when you cannot remember a shortcut: type what you want, such as "format document", and run it from the list. VS Code also asks whether to trust a folder before it runs tasks or extensions. Only trust folders you created or know.
No. Syntax colouring, IntelliSense and debugging are built in. Extensions add linting, formatting and previews.
ESLint finds possible bugs and enforces code rules. Prettier only changes layout, such as spaces and line breaks.
No. Visual Studio is a separate, larger IDE. VS Code is a light editor that is free and works on Windows, macOS and Linux.
Open Settings with Ctrl+, and search for "theme" or "font size", or use the Color Theme command from the Command Palette (Ctrl+Shift+P).
Install VS Code, open a project folder and rely on the built-in JavaScript support. Add ESLint and Prettier for cleaner code, turn on format on save and use the integrated terminal or debugger to run your scripts. Keep the setup small and add tools only when you have a reason.