course content

Course Content

Introduction to JavaScript


Another way to define a variable in JavaScript is using the const keyword. The primary difference between let and const is that variables created using const cannot change their values, whereas using the let keyword allows changes to the variable's value.

Let's compare the behavior of variables using let and const. Take a look at the following example where we can change the value of the a variable:

In contrast, let's examine the behavior of the b variable. We will encounter an error: TypeError: Assignment to a constant variable.


Constants are used as immutable variables. You can define a constant once and use it multiple times.

Constants provide data integrity while allowing for quick refactoring.


Refactoring involves making structural changes to the code, such as modifying values, variable/function names, and more.

For example, consider maxHeight for site elements. You can release a site update by changing the maximum height of elements with just one modification in the code. However, it's important to note that you cannot change the maximum height during runtime, ensuring data integrity.


Define a constant variable:

= 50;

Click or drag`n`drop items and fill in the blanks

Everything was clear?

Section 2. Chapter 3