Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This From visual blocks to typed JavaScript 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 | |
|---|---|---|
| 1console.log("Hi"); | Aconsole.log("Start"); console.log("End"); | |
| 2let score = 0; | BOne typed line that does the job of a 'set score to 0' variable block | |
| 3Sequence still applies in typed code: lines run from top to bottom, just like stacked blocks | Cif (score > 10) { console.log("Win"); } | |
| 4A decision from an if block becomes typed text using the word if, a condition and curly braces | DWrong capital letter: JavaScript is case sensitive, so Console is not the same as console. It must be console.log. | |
| 5Console.log("Hello"); | EThe closing quote is missing, so the text is not closed. It needs a matching quote before the bracket. | |
| 6console.log("Hello); | FOne typed line that does the same job as a 'say Hi' block, and it must be spelled exactly |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
JavaScript — 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.console.log("Hello, world!");let name = prompt("What is your name?");if (score > 5) {
console.log("You win!");
}for (let i = 0; i < 3; i++) {
console.log("Hi");
}let lives = 3;
lives = lives - 1;
console.log(lives);