You are on page 1of 19

JAVASCRIPT 1: PROGRAMS WITH LOOPS, VARIABLES AND CONDITIONS

LESSON 1: Modify & run simple code


This lesson introduces commands such as alert and prompt which are explored in more detail in
lesson 2. Students make simple changes to the code and click run to see the outcome.
Student Objective: We can run and debug code, add comments, ask questions, and output
messages.

Vocabulary: alert bug comment JavaScript prompt

Alert: display a message box with an OK button.


Bug: A bug is an error in coding or logic that causes a computer program to work
incorrectly.
Comment: comments are not run, but are there to explain how code is structured
and how it functions. It is for humans reading your code. // in JS, {{}} in HTML, /* */
in CSS, and # in PY.
JavaScript: JavaScript is the computer programming language that is often used to
make interactive web sites.
Prompt: asks the user a question.
LESSON 2: Write alert messages
This lesson focuses on writing alert messages and using \n to separate text onto different lines.
Single ' ' and double " " quotes are used to show they do the same thing.
Student Objective: We can write alert messages and display text on new lines.

Vocabulary: quotes new line character

Quotes: Also called speech marks and often used for showing speech in text, single ‘
and double “ quotes are also commonly used in coding.
New line character: The new line character \n is a special character does the same
thing as pressing the enter key on the keyboard. It puts anything after it onto a new
line. It is used inside strings (text), or joined using + to variable, strings or other
values.
LESSON 3: Math with order of operations
This lesson introduces the mathematical symbols + - * / ( ) used to create simple calculations.
There are a number of tasks where students complete calculations in their heads to practice using
the symbols. The final two tasks explain that certain symbols * and / must be calculated first, and
operations in brackets take priority.
Student Objective: We can identify the different mathematical symbols, the order of
operations and know that brackets take priority.

Vocabulary: calculation computer programmer order of operations + - / *


Calculation: the action, process or result of computation. For example, when working out an
answer by addition, subtraction, multiplication, or division.
Computer programmer: a person who designed and writes and tests computer programs.
Order of operations: BEDMAS, BODMAS or PEMDAS is the order you do math’s operations when
there’s more than one type of operation: Parentheses/brackets ( ) and exponents 22 are first.
Division / and multiplication * are next and have the same priority. Addition + and subtraction –
are last and have the same priority. If there are 2 operations of the same value, solve left to right.
+ : adds numbers and joins strings 4 + 8 equals 12 ‘4’ + ‘8’, 4 + ‘8’ and ‘4’ + 8 are equal to ‘48’
LESSON 4: Calculations & strings
This lesson includes tasks on creating calculations using a range of mathematical
symbols + - * / ( ).
Students are also introduced to using the + symbol to join strings of text so they are able to output
calculations in an alert message to provide context to the numerical answer.
Student Objective: We can create calculations using a range of mathematical symbols, use
the + symbol to join strings of text and combine everything together in an alert message.

Vocabulary: kilobyte string


Kilobyte: the term kilobyte and its symbol kB are used to refer to either 1000 (103) or 1024 (210)
bytes.
String: a sequence of characters “string” together. Strings are enclosed in ‘ or “ quotes.

Note: Joining text with + is called concatenation


LESSON 5: Creating variables
This lesson demonstrates to students how updating values in calculations manually can be time
consuming. They are introduced to the concept of a variable which is basically a place to store a
value that may change. Tasks in this lesson include creating variables, updating manual values,
and using variables as part of other variables. Students also start exploring rules for variable
names.
Student Objective: We can create and update variables to store numbers to be used in
calculations.

Vocabulary: digit underscore variable


Digit: any of the symbols from a number system, 0 and 1 in binary, 0 to 9 in decimal. Also known
as a finger or toe.
Underscore: a symbol found on the same keyboard key as the hyphen. ( _ ). Often used in variable
names.
Variable: stores a value that can be used later and modified by the program.
LESSON 6: Bugs
This lesson provides students with the information they need to deal with a range of bugs
including syntax errors and issues with variables names. They learn to avoid spaces, use the
correct type of quote marks and be consistent with case when writing variabl es.
Student Objective: I can identify and fix bugs in code including syntax and variable name
errors.

Vocabulary: bug case sensitive syntax


Bug: a bug is an error in coding or logic that causes a computer program to work incorrectly.
Case sensitive: the computer requires text to be written in a specific letter case in order to work
correctly.
Syntax: the result that define how to combine the symbols, keywords and variable names etc. into
valid code.
LESSON 7: Move the robot
In this lesson students will use code to command a robot around a track, There are three robot
commands to allow students to move a robot left, right, turn 180 degrees and go forward :

• robot.forward()
• robot.left()
• robot.right()
Student Objective: We can use a range of robot commands to move a robot along a path to
a target point.

Vocabulary: robot.forward() robot.left() robot.right() web browser


Robot.forward(): a javascript function that moves the robot one square forward.
Robot.left(): a javascript function that turn the robot 90 degree to the left.
Robot.right(): a javascript function that turn the robot 90 degree to the right.
Web browser: a web browser is the software you use to retrieve and view web pages. The most
popular web browsers are chrome, firefox, safari, opera, edge and the now unsupported internet
explorer (IE).
LESSON 8: Input & output information
This lesson builds the student's confidence in writing prompt commands, displaying default
values, storing responses in variables and using the variables to output information
in alert commands.
Student Objective: We can gather, store, and display information through the use of
variables, prompts and alerts.

Vocabulary: default
Default: The value that is automatically used if none is provided.
LESSON 9: Join strings & numbers
This lesson starts by revisiting joining strings using the + symbol. It progresses to how numbers
behave when they are alongside a string and how strings behave when they are alongside a
multiplication * symbol. The lesson ends with practice of predicting what the output of
combinations of strings, + joining symbols, numbers and calculations will be.
Student Objective: We can translate code input into code output by understanding how
strings, numbers and calculation’s function.
LESSON 10: Variable review quiz
This lesson consists of five quizzes covering a range of aspects for creating variables including:

1. Setting up a variable using the var keyword

2. Following correct naming conventions.

3. Calculating the value of a numerical variable.

Student Objective: We can create variables following correct naming conventions and
follow order of operation rules when calculating numerical variables.
Alert quiz:::
Maths quiz:::
Variable quiz:::

You might also like