Client Portal Secure Access
JavaScript Foundations Beginner 14 minute lesson

Variables and values

Learn how JavaScript stores information in named variables so it can be reused later.

What you will learn

  • Learn how JavaScript stores information in named variables so it can be reused later.
  • Explain what variables and values are in plain English.
  • Read tiny beginner JavaScript examples without pressure to memorize every symbol.

What you will learn in this lesson

This is the first lesson where JavaScript starts to look a little more like code. That can feel intimidating at first, but the idea behind it is simple.

Variables help JavaScript remember information. If the code needs a name, a number, or a short message later, it can store that information first and use it again when needed.

Your lesson goals are simple:
– understand what a variable is in plain English
– understand what a value is in plain English
– read tiny examples without rushing
– see why variables make code easier to reuse and change
– leave this lesson feeling calmer about beginner JavaScript syntax

The big idea is small

A variable is a named place where JavaScript stores a value.

What a variable is in plain English

A variable is a name that points to stored information.

You can think of it as a labeled spot where JavaScript keeps something for later. The name helps the code find that stored information again instead of guessing.

If a page needs to remember a student's name, a score, or a short message, a variable gives that information a clear label.

A variable is not the stored thing itself

The variable name is the label. The stored information is the value.

What a value is in plain English

A value is the actual information being stored.

The value might be text like "Ava". It might be a number like 3. Later, it might even be a true-or-false answer such as true or false.

The important part for now is this:
the variable is the named place
the value is what is inside it

Keep the two roles separate

If you can tell the difference between the name and the stored value, you are already learning the right way.

Tiny example 1: storing a name

Here is a tiny example:

let studentName = "Ava"

Line by line:
The word let starts a simple variable line.
studentName is the variable name.
"Ava" is the stored value.

This line tells JavaScript to remember the name Ava so the code can use it again later.

The name describes the job

A variable like studentName is easier to understand than a vague name like x.

Tiny example 2: storing a number

Here is another tiny example:

let lessonCount = 3

Line by line:
let starts the variable line.
lessonCount is the variable name.
3 is the value being stored.

This is useful when the code needs to remember a count, score, or step number.

Values are not always text

A value can be a number too. JavaScript can store different kinds of information in variables.

Tiny example 3: storing page text for later

One more beginner-safe example:

let welcomeMessage = "Welcome back"

Line by line:
welcomeMessage is the variable name.
"Welcome back" is the value.

A line like this is useful when the page may need to show the same message more than once. Instead of rewriting the text everywhere, JavaScript can store it once and reuse it.

Stored text can be reused

A variable helps you keep one useful value ready for later instead of repeating it everywhere.

Why variables are useful

Variables help because they let code:

– reuse information later
– change information in one place
– stay easier to read

If the code stores a student's name once, it can use that same value later without typing it again and again. That makes small code examples feel clearer and less messy.

Variables reduce repetition

Store once, use again. That is one of the biggest beginner wins variables give you.

Common beginner mistakes with variables

A few small mistakes happen often:

Confusing the variable name with the stored value:
studentName is the label. "Ava" is the value.

Using a vague variable name:
A name like x gives less help than a name like welcomeMessage.

Changing too many things at once:
It is easier to learn when you change one small part and then check the result.

Feeling like every symbol must be memorized immediately:
It does not. The goal right now is understanding the idea of storing information, not perfect memory.

Most variable mistakes are small

If the line feels confusing, slow down and ask: what is the variable name and what is the value?

Short recap before lesson 3

A variable is a named place where JavaScript stores a value.
The variable name is the label.
The value is the information being stored.
Variables help code remember, reuse, and change information more clearly.

That is the real win from this lesson. You do not need advanced rules yet. You only need a calm understanding of how JavaScript stores simple information.

You only need the core idea

If you can spot the variable name and the stored value in a tiny example, you are ready for the next lesson.

Mark this lesson complete when the main idea feels clear.

The website can remember completion in this browser. Full saved progress, quizzes, 22 Practice Labs, and certificate tracking live inside the Academy app.