← ACARA Digital Technologies Years 7–8

const for values that never change

Declares a variable whose value is set once and cannot be reassigned. Use it for fixed values like a maximum score. Changing it later causes a TypeError.

Understanding const for values that never change in ACARA Digital Technologies Years 7–8

What it does: A fixed number of rounds is set once, so const is the right choice. The score goes up during the game, so it must be declared with let so it can be reassigned. The keyword const comes first, then the name, then = and the value. A const cannot be reassigned. JavaScript stops the program with a TypeError. If a value will change later, use let. A const would cause a TypeError when you update it. A const is set once, at the moment it is declared. You cannot leave it empty and fill it in later. A running total changes each time, so let is the correct keyword and const causes a TypeError.

Common mistakes: MAX_SCORE was declared with const, so it cannot be reassigned. This causes a TypeError. The line should cap the score: score = MAX_SCORE;. radius changes on the next line, so it must be declared with let. With const, radius = radius * 2 would cause a TypeError. It should be let radius = 5;.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 562–580) and word search (Modules 522–580).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which line correctly declares a value that should never change?
MAX_SCORE const = 100;const MAX_SCORE = 100;
Matches
const MAX_SCORE = 100; MAX_SCORE = 200;
↓
MAX_SCORE is a const, so it cannot be reassigned. This causes a TypeError: Assignment to constant variable.
Applying
Meanings
Term
const
Meaning
Declares a variable whose value is set once and cannot be reassigned. Use it for fixed values like a maximum score. Changing it later causes a TypeError.
Practice
const maxScore = 100;
Testing
Gaps
MAXSCORE = 100;
Check Answer
Spots
3score += 15;
4MAX_SCORE = score;

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Owl' badge — Wise Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which line correctly declares a value that should never change?
A. const MAX_SCORE = 100; ✓
B. MAX_SCORE const = 100;
The keyword const comes first, then the name, then = and the value.
2. What happens when this code runs? const maxLives = 3; maxLives = 2;
A. maxLives becomes 2 with no error
B. TypeError: Assignment to constant variable ✓
A const cannot be reassigned. JavaScript stops the program with a TypeError.
3. Which variable is best declared with const?
A. The player's current score
B. The number of days in a week ✓
The days in a week never change, so use const. A score changes during a game, so it needs let.
4. Which variable is best declared with let?
A. let lives = 3; (it goes down when the player loses a life) ✓
B. const lives = 3; (it goes down when the player loses a life)
If a value will change later, use let. A const would cause a TypeError when you update it.
5. True or false: a const must be given its value when it is declared.
A. True: const PI = 3.14; ✓
B. False: const PI; can be given a value later
A const is set once, at the moment it is declared. You cannot leave it empty and fill it in later.

Match the Pairs

const MAX_SCORE = 100; → Creates a fixed value called MAX_SCORE that is set once and cannot be changed later
let lives = 3; → Creates a variable that can be given a new value later, such as when a life is lost
Use const for a value that should never change, like the number of rounds in a game → const ROUNDS = 5;
Use let for a value that will change as the program runs, like a player's score → let score = 0;
const MAX_SCORE = 100; MAX_SCORE = 200; → MAX_SCORE is a const, so it cannot be reassigned. This causes a TypeError: Assignment to constant variable.
const total = 0; total = total + 10; → total needs to change, but const does not allow reassignment. It should be declared with let instead.

Key Term

const
Declares a variable whose value is set once and cannot be reassigned. Use it for fixed values like a maximum score. Changing it later causes a TypeError.

Fill in the Blanks

1. const MAX_SCORE = 100;
Hint: Type the keyword that declares a value that can never be reassigned.
2. let lives = 3; // this value will change
Hint: Type the keyword for a variable whose value can be changed later.
3. const TAX = 10; console.log(5 * TAX);
Hint: Type the name of the constant that holds the fixed value.
4. const LIVES = 3; LIVES = 2; // TypeError
Hint: Type the name of the error JavaScript gives when you reassign a const.
5. const SCHOOL_YEARS = 6; // never changes
Hint: Type the keyword you choose for a fixed value that never changes.

Spot the Error

Question 1
A const MAX_SCORE = 100;
B let score = 90;
C score += 15;
D MAX_SCORE = score;
Line D — MAX_SCORE was declared with const, so it cannot be reassigned. This causes a TypeError. The line should cap the score: score = MAX_SCORE;
Question 2
A const PI = 3.14;
B const radius = 5;
C radius = radius * 2;
D console.log(PI * radius);
Line B — radius changes on the next line, so it must be declared with let. With const, radius = radius * 2 would cause a TypeError. It should be let radius = 5;
Question 3
A const TAX = 0.1;
B let price = 50;
C const total;
D console.log(total);
Line C — A const must be given its value when it is declared, because it can never be assigned later. It should be const total = price + price * TAX;
Question 4
A const MAX_LIVES = 3;
B let lives = MAX_LIVES;
C MAX_LIVES--;
D console.log(lives);
Line C — MAX_LIVES is a const, so it cannot be changed with --. This causes a TypeError. The changing variable lives should be reduced: lives--;
Question 5
A cosnt MAX_PLAYERS = 4;
B let joined = 2;
C console.log(MAX_PLAYERS - joined);
Line A — The keyword const is misspelled as cosnt. JavaScript does not recognise it, so it is a syntax error. It should be const MAX_PLAYERS = 4;

Student with a class code? Join your class →