Variables: let, const, var, online

Six activities your students do on their own devices. See who's finished, and their scores.

Variables: let, const, var in one minute

What students need to know

var is the original keyword, now mostly replaced by let/const. Using const shows the value is meant to stay the same.

let creates a variable whose value can change. const locks the value so it can't be changed.

Mistakes students make

  • 'const' is misspelled as 'cnst'.
  • const values cannot be reassigned after they're set.
  • 'let' must be lowercase - a capital L causes an error.
  • You can't redeclare 'modernWay' - it's already declared with let.
PREVIOUS · MODULE 2Comments
YOU ARE HERE · MODULE 3Variables: let, const, var
NEXT · MODULE 4Basic Data Types

Discover other journeys with this module

What students will learn in this module

Every question in Module 3

Quick questions

  1. Can a variable declared with let be reassigned later?AYesBNo
  2. Can a variable declared with const be reassigned later?ANoBYes
  3. Is 'var' the modern, preferred way to declare variables?AYesBNo
  4. Does 'let count = 5;' declare a variable named count?ANoBYes
  5. Can you redeclare the same variable name with let twice?ANoBYes

Key terms

Students type the meaning of:

  • let

Match the pairs

let age = 12;Match it to what it does
const name = "Sam";Match it to what it does
The older, less preferred way to declare variablesMatch it to what it does
Signals to other developers that a value is fixedMatch it to what it does
const pi = 3.14; pi = 3.15;Match it to what it does
LET score = 0;Match it to what it does

Fill in the blanks

  1. ___ age = 12

    Hint: Type the keyword used to declare a variable that can change.

  2. _____ name = "Sam"

    Hint: Type the keyword used to declare a variable that never changes.

  3. let score = 0;
    score = score _ 1

    Hint: Type the operator used to add to the score.

  4. ___ total = 100

    Hint: Type the older keyword used to declare a variable.

  5. _____ pi = 3.14

    Hint: Type the keyword used to declare a variable that never changes.

Spot the error

Question 1

Alet age = 12;Bcnst name = "Sam";Cage = 13;

Question 2

Aconst pi = 3.14;Blet score = 0;Cscore = score + 1;Dlet count = 5;Epi = 3.15;

Question 3

ALET total = 10;Blet count = 5;Ccount = 6;

Question 4

Avar oldWay = 1;Blet modernWay = 2;Cconst modernWay = 3;

Question 5

Aconst name = "Sam";Blet age = 12;Cage == 13;