Do you want a web page to respond when someone clicks, or do you want to rename forty files without touching them one by one? Both are JavaScript, and the answer changes part of the setup below. Everything else on this list is the same either way, and all of it can be finished in an afternoon.
Two destinations, one language
Browser work and machine work use the same syntax but very different furniture. A page needs an HTML file and a browser; a script that renames files needs a runtime installed on your computer and no browser at all. Choosing now saves you from installing both and using neither. If you are undecided, start with the browser — the feedback is faster and the tooling is already on the machine.
Before anything gets installed
- A place to keep projects that is not the desktop, with one folder per project and no spaces in the names.
- One current browser, opened to its developer tools at least once so the panel is familiar.
- A text editor you can open in under three seconds.
- Two hours in which nobody expects anything from you.
- One small idea worth building, written in a sentence.
The ten-minute install
For browser work, there is nothing to install at all. Create a folder, make a file called index.html and a file called script.js beside it, and link the script from the HTML with a script tag at the end of the body. Open the HTML file in the browser and you are running JavaScript in a page. Every additional tool can wait until it solves a problem you have actually met.
For machine work, install a current version of the runtime from its official site, confirm it answers on the command line, and write a single file that prints a line of text. If that prints, your setup is done. Package managers, version switchers and global tools are optimisations for later, not requirements now.
Your first working file
Write three things and no more: a variable holding a value, a function that uses it, and a call that prints the result. Then change the value and reload. Watching the output change because of an edit you made is the moment the setup stops being abstract. If something does not appear, open the console — the error will tell you whether the script failed to load or failed to run.
Signs the setup is actually working
- You can go from an empty folder to a page with a script in under two minutes.
- An intentional typo produces a visible error rather than silence.
- Reloading the page shows your latest change without clearing a cache by hand.
- You know exactly where the files live and can find them without a search.
- You can stop a runaway loop without rebooting the machine.
That last one matters more than it sounds. An infinite loop in a browser tab can be closed; the same mistake on the command line is stopped with a keyboard interrupt. Learn the escape hatch before you need it.
If four of the five signs above are true, stop configuring and start building. The checklist has done its job, and the next useful thing you can do is write a program that does something small and slightly boring.