Full-stack Web Technologies

CHAPTER 1
Javascript

Javascript started as a scripting language for the first browsers. It was slow and simple, but as the web took off, more and more money was put into making it fast, and now it is one of the fastest languages, and the most used in the world.

Javascript is an interpreted language (it does not have a compilation step), but it is fast because it has a very sophisticated JIT. It is also garbage collected, i.e., programmers do not have to worry about allocating memory.

NodeJS

NodeJS is a Javascript runtime which took the Chrome Javascript Engine (called V8), and made it standalone. Installing Node implies either:

  1. Downloading an installer which does everything automatically.
  2. Downloading a ZIP file, decompressing and setting the PATH variable (Path in Windows).

LTS (Long-Term Support) versions are more stable and usually have even numbers (14, 16, 18...). Odd versions are the latest, and they more thoroughly test the features that will be included in the next LTS version.

Node Version Managers

Sometimes it is necessary to install different versions of NodeJS because of constraints that different projects have (typically coming from the libraries that they need). Installing many versions of Node by hand is cumbersome so many "Node Version Managers" exist (n, nvm, etc.), which let you download different versions, switch between them easily, etc.

Volta

One of the best version managers to date is Volta. It also manages yarn, pnpm and other tools. The good things about Volta is that is automatic, it will execute the Node version configured for your projects (very good for collaboration). Installing it is easy:

curl https://get.volta.sh | bash

If you are using Windows, get the Windows installer or use it within WSL.

Volta commands:

volta list node            # List installed node versions
volta install node@18      # Install version 18 (latest)
volta install node@18.2.1  # Install a more precise version
volta pin                  # Pin current version to a package