logo
Course

Variables Introduction

Loading...

Learning Objective: Understand what variables are, their purpose, and how to create them.

Welcome to the first section of the course! Over the next few lessons, we’ll explore variables and data types, two foundational concepts in programming.

Variables are like that hold reusable data.

Their sole purpose is to label and store data in memory.

This data can then be used through the entirety of your program.

Think of variables in JavaScript as containers which hold reusable data. In other words, they are units of storage, like some sort of box into which we can put data.

There are three simple steps to creating a variable and using it’s data:

  • Create a variable and give it a name.
  • Store your value in it.
  • Retrieve and use the stored value from the variable.

Now in the next lesson, I’ll teach you how to create your first variable!

  • the name of the identifier must be unique
  • the name of the identifier should not be any reserved JavaScript keyword (for example, we cannot declare a variable like this: )
  • the first character must be a letter, an underscore (_), or a dollar sign ($). Subsequent characters may be any letter or digit or an underscore or dollar sign.