course content

Course Content

Introduction to JavaScript


Variables play a crucial role in programming, allowing you to store and reuse values.


A variable is like a container holding different data types, such as numbers, text, or more complex structures.

Before using variables, they must be defined. To define a variable, use the let keyword and choose a name for it:


Variable names should follow the camelCase style. camelCase means that words are written together without spaces, and each word (except the first) is capitalized.

By default, a new variable contains the undefined value, indicating that no value has been assigned.


The undefined value signifies that a value has not yet been assigned to the variable.

You can assign a value to a variable using the assignment operator (=):

Alternatively, you can assign a value when the variable is defined:

Using Variables

Variables can be used to represent various values in your code and can be reused multiple times, reducing code repetition.

You can assign and reassign values to variables as needed:

Variables are essential in programming because they allow you to reuse the same value many times. Consider a scenario where you've written 1000 lines of code using a specific value but made a typo that appears multiple times. In such a case, you'd need to correct every occurrence of that word in your code, which would be a significant waste of time.

Now, let's examine a similar example with fewer lines:

In this example, the author accidentally omitted the letter l in the word World. To fix this program, you only need to correct one occurrence of the typo.

Look at the following example:

You can fix it by changing one letter in the variable value from "Word" to "World". Please correct the provided example on your own.


In the example above, we used string concatenation. We will delve into string concatenation in the next section.


Define a variable:

let = ;

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

Everything was clear?

Section 2. Chapter 1