Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This const for values that never change worksheet is part of the ACARA Digital Technologies Years 7–8 — Programming with Control Structures and Functions (JavaScript) journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1const MAX_SCORE = 100; | AMAX_SCORE is a const, so it cannot be reassigned. This causes a TypeError: Assignment to constant variable. | |
| 2let lives = 3; | BCreates a fixed value called MAX_SCORE that is set once and cannot be changed later | |
| 3Use const for a value that should never change, like the number of rounds in a game | Cconst ROUNDS = 5; | |
| 4Use let for a value that will change as the program runs, like a player's score | DCreates a variable that can be given a new value later, such as when a life is lost | |
| 5const MAX_SCORE = 100; MAX_SCORE = 200; | Etotal needs to change, but const does not allow reassignment. It should be declared with let instead. | |
| 6const total = 0; total = total + 10; | Flet score = 0; |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
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.const MAX_SCORE = 100;let lives = 3; // this value will changeconst TAX = 10; console.log(5 * TAX);const LIVES = 3; LIVES = 2; // TypeErrorconst SCHOOL_YEARS = 6; // never changes