BACK_TO_ROOT
MODULE 01

VARIABLE CONTAINMENT

Variables are the storage crates of your application. They hold data in memory for later use.

let

Declares a block-scoped local variable, optionally initializing it to a value. Can be reassigned.

let score = 0;
score = 10;
// Valid operation

const

Declares a block-scoped read-only constant. Cannot be reassigned.

const PI = 3.14;
PI = 3.15;
// TypeError: Assignment to constant variable

INTERACTIVE_SIMULATION

LIVE
JS_INTERACTIVE_TERMINAL

1. DECLARATION

2. ASSIGNMENT

MEMORY_STATE
// Memory empty
CONSOLE_OUTPUT
>System initialized. Ready for input.

Pro Tip

Always default to using const. Only use let when you know the value needs to change (like a counter or score).