Getting Started With JavaScript Programming

Important

This guide takes you through the process of getting started with programming using the JavaScript programming language. This was requested by several users in the AoPS community, as JavaScript is a very versatile language and can be used to make web pages interactive, build browser-based games, and even mobile apps for different operating systems.

Please note that the sections flow from one to the next, so it's recommended to read through this document in order from top to bottom. Additionally, this page is a work in progress, so expect constant updates with this.

Installing a JavaScript runtime

In order to run JavaScript code, you need a JavaScript runtime. This is essentially the actual program that will run your code.

There are many different JavaScript runtimes available, but for the purpose of this tutorial, we recommend using the latest Node.js LTS version of 14.17.0 (which includes npm 6.14.13).

  1. Go to the Node.js download page at https://nodejs.org/en/download/, and download the package that corresponds to your computer type (Windows or Mac). Some browsers will save the file automatically, others may pop up a box asking you if you want to save the file, in which case you should click the "save file" option. Depending on how your browser is configured, you may be asked where to save the file. If this is the case, keep track of where you save the installer.
  2. Find where the installer was downloaded and double click on it to run it. On most browsers, you should simply be able to double-click the installer from the browser's "Downloads" window or menu. You may also have to click "Run" or "Yes" to a security window -- do this if necessary.
  3. The setup wizard should launch. You should just click "Next" for every option in the setup wizard (i.e. use the defaults) unless you have some specific reason not to.