Variables (let, const, var)
Variables are containers for storing data values. JavaScript has three ways to declare variables: let, const, and var.
let - Block-Scoped Variables
Use let for variables that can be reassigned:
const - Constants
Use const for values that shouldn't change:
var - Legacy Variables
var is the old way to declare variables. Prefer let and const instead:
Naming Rules
Variable names must follow these rules:
Exercise: Create Variables
Create three variables and print them:
Exercise: Const vs Let
Use const for a fixed value and let for a changing value:
Up next · Lesson 5 of 37
Numbers
1 min read
4 of 37 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

