← ACARA Digital Technologies Years 7–8 — Programming with Control Structures and Functions (JavaScript)

ACARA Digital Technologies Years 7–8 — Programming with Control Structures and Functions (JavaScript) Hangman

Years 7–8 · Australian Curriculum · 66 key terms.

Theme
Words

Every word, shuffled.

Players

Writing, changing and fixing JavaScript programs with decisions, loops and functions. See the whole journey →

Want your own words? Free Hangman Generator →

Same words, on paper

The quiet activity after the loud one. Free to print, answer keys included.

CrosswordProgramming with Control Structures and Functions (JavaScript) · Programming with Control Structures and Functions (JavaScript) · Programming with Control Structures and Functions (JavaScript) · all 15

Word searchProgramming with Control Structures and Functions (JavaScript) · Programming with Control Structures and Functions (JavaScript) · Programming with Control Structures and Functions (Python) and Programming with Control Structures and Functions (JavaScript) · all 8

Worksheetfor any module, with answer key

When your class is on devices — Snake Break and Diamond Dash run on the same modules, with a free class.

The 66 key terms

1JavaScript
A text-based language where each block you snapped together becomes one line of code that you type exactly, and the computer follows it literally.
2console
The panel beside the editor where your program's output appears after you press Run. Each console.log shows in order, and you run the program again after every change.
3console.log()
Prints a value or message to the browser or terminal console for debugging or output.
4let score = 0;
A statement is one instruction in JavaScript, usually written on its own line and ended with a semicolon (;). This line is one statement.
6sequence
Statements run one after another from top to bottom, so changing the order of lines can change the result. A variable must be set before it is used.
7console.log("Hi");
JavaScript is case-sensitive, so console.log must be typed exactly. Every opening quote, bracket or brace needs a matching closing one, like the quotes and ( ) here.
8let
Declares a variable whose value can be changed later.
9camelCase
A naming style with no spaces: the first word is lowercase and each later word starts with a capital letter, like studentScore. PascalCase also capitalises the first word.
10score = score + 1;
Reassigns an existing let variable. The right side is worked out first using the old value, then the new value replaces it. Don't write let again.
11const
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.
12string
A data type that holds text, written inside quotes like "hello".
13number
A value written without quotes, whole (7), decimal (3.5) or negative (-2), that you can calculate with. 5 is a number but '5' in quotes is a string, which is text.
14boolean
A data type with only two values, true or false, written in lowercase with no quotes. Comparisons like 5 > 3 give a boolean, and true is not the same as the string "true".
15typeof
An operator that returns a string naming the data type of a value.
19total += price
A shorthand update. Operators like +=, -=, ++ and -- change a variable using its own value, so total += price means total = total + price. count++ adds 1 and count-- takes away 1.
22prompt("question")
Shows a message box, waits for the user to type, then returns what they typed as a string. Store it in a variable. Cancel returns null.
23Number()
Converts a value, like a string, into a number data type.
24console.log, prompt, let
Blocks have typed JavaScript equivalents: a say block becomes console.log, an ask block becomes prompt, and a set variable block becomes let (or an assignment with =).
25tracking table
A table with a column for each variable and a row for each step or repeat. It shows how the values change, and the first row holds the starting values.
30logical OR
Logical OR joins two conditions. It is true when at least one is true, and false only when both are false. Example: day === 'Sat' OR day === 'Sun' is true on a weekend.
34else
Runs a block of code when every earlier if or else if condition was false.
35else if
Checks another condition only when the previous if or else if condition was false.
36if (age >= 10 && age <= 15)
A compound condition joins several tests in one if using && (and), the or operator and ! (not). Brackets set the order. Use it for range checks, like age between 10 and 15.
37if (a) { if (b) { } }
A nested if is an if inside another if's braces. The inner if is only checked when the outer condition is true. Each if has its own braces and the inner one is indented again.
39if (score >= 50) { } else { }
A visual if-else block becomes if/else code. The hexagon condition goes in brackets as a comparison, and the steps from each part of the block go inside curly braces.
40while
Repeats a block of code as long as its condition inside parentheses stays true.
41for
Repeats a block of code a set number of times, using an initializer, condition, and update expression.
42console.log(i)
Inside a for loop, the counter i changes on every repeat, so using it in the loop body gives a different value each time, like 1, 2, 3. It only exists inside the loop.
43for (let i = 10; i >= 1; i--)
A for loop that counts down: start i high, keep going while i >= 1, and subtract 1 each time with i--. Use i -= 2 to count down in steps of 2.
44total += value;
Adds each value to a running total inside a loop. Start with let total = 0 before the loop, and use count++ to count how many times something happens. Print the results after the loop.
45for (...) { if (...) { ... } }
An if inside a loop body is checked again on every repeat, so each pass can take a different branch, such as counting only the matches.
46while (count < 5) { count++; }
A loop runs forever if nothing in its body changes the variable its condition tests. Updating count each time lets the condition become false so the loop stops.
47break
Exits a loop completely, stopping it before it finishes all its passes.
48while (!(num >= 1 && num <= 10))
A loop that re-asks with prompt() while the answer fails the check, showing an error message each time, so bad input never continues. Here it repeats while num is outside 1 to 10.
49for vs while
Use for when you know how many times to repeat, like 1 to 10. Use while when repeating depends on a condition, like asking until the answer is correct.
50nested loop
A loop inside another loop. The inner loop runs all its repeats for every single repeat of the outer loop, so an outer 3 and inner 4 gives 12 passes.
51while (score !== 5)
Typed form of a repeat until score = 5 block: keep looping while the opposite is true. A repeat 10 block becomes a for loop, and forever becomes while (true).
53function
Declares a reusable block of code with a name, which can be run later by calling it.
54functionName()
Calling a function: write its name followed by brackets, like sayHello(), to run its code. You can call it as many times as you like. Without the brackets, it does not run.
55calculateTotal
A function name is a camelCase verb phrase that says what the function does, like calculateTotal or printMenu. Start with a verb, make it meaningful and use no spaces.
56parameter
A named placeholder inside a function's parentheses that receives an input value when called.
57function add(a, b) {
Separate several parameters with commas. A call like add(2, 3) must give one argument for each, in the same order. A missing argument becomes undefined.
58return
Sends a value back out of a function and ends its execution at that point.
59let result = square(4);
A function call is replaced by the value it returns, so you can store it in a variable, print it or use it in a calculation like square(2) + square(3).
61if (isAdult(age))
Uses a function that returns true or false directly as the if condition, so the code inside runs only when the call isAdult(age) gives back true.
62if (score >= 80) { return "A"; }
A function can use if and else to make a decision, then return a different value from each branch. A default return at the end covers every other case.
63function sumTo(n)
A function that loops up to its parameter n, adds each number to a total declared inside it, then returns that total after the loop ends so the caller gets the finished answer.
64helper function
A small function that does one job and is called from inside another function, so a big task is built from small, reusable parts.
65scope
The area of code where a variable can be accessed; variables declared inside a function are local to it.
66SyntaxError
An error shown when code breaks JavaScript's rules, like a missing quote, bracket or brace. JavaScript can't read the code, so the program won't run until you fix it.
67script.js:3
Part of an error message: the file and line number where JavaScript noticed the error. Check that line first, but the real mistake may be a line earlier.
68ReferenceError
An error shown when code uses a variable or function name that has not been declared, often from a typo, wrong capital letter, wrong scope or using it before declaring it.
69TypeError: Assignment to constant variable
The error JavaScript shows when code tries to give a new value to a const variable. Fix it by declaring the variable with let if its value needs to change.
70logic error
A mistake that lets the program run with no error message but gives a wrong result, such as using > instead of >=, the wrong operator, or steps in the wrong order.
71off-by-one error
A loop bug where it runs one pass too many or too few, caused by a wrong start value or mixing up < and <=. For example, i starting at 0 with i <= 5 runs 6 times, not 5.
72console.log("total:", total)
Prints a labelled variable value while the program runs, so you can spot the line where the value first goes wrong. Remove these debug lines once the bug is fixed.
73trace table
A table with one row per loop repeat, showing the counter, other variables and any output, filled in by hand until the condition is false.
74// console.log(total);
Putting // in front of a line makes JavaScript skip it, so you can switch code off to find a bug. Remove the // to switch it back on.
75test case
A chosen starting value you try in an algorithm, with the result you expect. Use one for every path and for a loop that runs zero times, then compare expected and actual results.
76console.log("expected 25, got", square(5))
Test a function by calling it with chosen inputs, logging the actual result next to the expected value, then recording pass or fail. Retest after any fix.
77predict, change, run
Read the code and predict what it does, change one small part (a value, condition or message), run it, then compare the result with your prediction.
78debugging
Finding and fixing bugs: run the program, read the error or compare wrong output with what you expected, find the faulty line, fix one thing, then rerun to retest.
79Math.floor(Math.random() * n)
Gives a random whole number from 0 up to n - 1. Math.random() gives a decimal from 0 up to 1, times n stretches it, and Math.floor rounds down. Add 1 to start at 1.
80sequence, selection, iteration
A complete program sets up variables first, repeats with a loop, uses an if inside the loop to make decisions, then prints the result after the loop ends.
81function double(n) { return n * 2; }
Build a program from small functions that take parameters and return values, then call them from a short main section. Add a comment above each function and test each one separately.
82while (guess !== secret)
The heart of a guessing game: keep asking for guesses until the guess equals the random secret number, using if/else if for too high or too low and a counter for the number of guesses.

Frequently Asked Questions

Do I need an account?

No. Hangman runs straight from this page — no account, no sign-up, nothing to install. If you add your class names, they are saved in your own browser and never sent to Cloodit.

How do I play it with my class?

Put the page on your whiteboard or projector and press Play. The class calls out letters and you click or type them. Six wrong letters and the word gets away. After every word its definition appears, so each round ends on the meaning, not just the spelling.

Can I use my own words?

Yes. The free Hangman generator at cloodit.com/hangman/ takes any list: one word or phrase per line, with a definition after a dash if you want it shown at the end of the round.

Can I put my students' names in?

Yes. Add your class list and a random student is called for each word. The list stays in this browser on this computer, so it is still there next lesson.

Are the worksheets free too?

Yes. Every module in this journey has a free printable worksheet with a full answer key, and there are crosswords and word searches built from the same key terms.

More Australian Curriculum Hangman

ACARA Digital Technologies Years 5–6 — Inside Digital Systems18 key terms ACARA Digital Technologies Years 5–6 — Networks and Sharing Data25 key terms ACARA Digital Technologies Years 5–6 — Representing Data with Numbers36 key terms ACARA Digital Technologies Years 5–6 — Algorithms with Branching and Repetition40 key terms ACARA Digital Technologies Years 5–6 — Staying Safe Online38 key terms ACARA Digital Technologies Years 5–6 — Digital Footprints55 key terms Make your own hangman →Paste any word list and play