course content

Course Content

Introduction to JavaScript

Literals and VariablesLiterals and Variables

Literals are just values in the program. Any number or text in quotes is literal (15, 12.25, "Hi", 'Word'). You can insert a literal into a variable for repeated use.

Variables play a crucial role in programming.

Note

Variables are named entities that store values that can be changed and utilized an unlimited number of times within a program.

To utilize a variable, it must first be defined. This is accomplished by selecting a variable name and using the let keyword:

You can assign a value to a variable by using an assignment operator, such as =:

Additionally, you can specify a value when defining a variable:

Usage

There are literals: 15, 11, "Hello", etc. Literals are some values that are used in code. Every literal should have a data type that will be described later.

You can use variables like literals in the code:

When the interpreter (the program that executes the code) looks for a literal but finds a variable, it receives the value of that variable as a literal.

question-icon

Define a variable:

let
_ _ _
=
_ _ _
;

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

dots
word
dots
"World"
down-icon

Section 2.

Chapter 1