Understanding the fundamentals of JavaScript
In this section, as a memory refresher, we'll quickly go over the basic concepts of modern JavaScript. If you are familiar with JavaScript, then you can skip this section.
As we have repeatedly mentioned, JavaScript can be used for both frontend and server-side scripting, so there is syntax or features that are particular to each environment— for instance, browser-side JavaScript does not have access to filesystems such as Node.js because of security reasons. So, in this section, we'll introduce concepts that can work in both environments/any environment.
Declaring variables
Variables are named storage for data. They can be used to store data that JavaScript can manipulate or work with. In JavaScript, you can define variables using two main keywords, const
and let
, although in older scripts, you'll find the var
keyword used for declaring variables. Using var
for variable declaration is generally discouraged...