A variable is a labelled box in which you store a value to reuse later. It is the basic building block of any program.

Declaring a variable

  • let — for a value that may change.
  • const — for a constant value that will never change.
let age = 25;
const prenom = "Marie";

The main data types

  • Number: 42, 3.14.
  • String: text between quotation marks.
  • Boolean: true or false.

Reach for const by default, and only use let when the value genuinely has to change. It makes your code clearer and prevents accidental reassignment.

Key takeaway: const for what stays put, let for what changes. Every value has a type: number, string or boolean.