Lesson Breakdown
Instructional 21 Lesson How can we perform basic math in JavaScript?
Day Title
Standards
Addressed
Description Computers are excellent machines for performing mathematical
operations.
Prior Knowledge Functional knowledge of initializing and assigning variables, receiving
user input and printing a message to the screen.
Proficiency with mathematical operations of addition, subtraction,
multiplication, and division.
Understanding of the remainder in a division equation.
Planning Notes If students lack a working understanding of the concept of division
and remainders, review it with warm up problems that produce a
remainder.
Teaching Learning ● Do Now:
Strategies Math Problem #1: You are a camp counselor and want to figure out
how groups you will have in the camp. The number of people in the
camp is equal to people and the number of people in a group is
equal to peoplePerGroup. Write an equation that demonstrates
how you would solve for the number of groups.
● Have students share their equation on the board or with a
partner and identify the mathematical operations used to
determine the answer. Prompt student thinking by providing a
value for people and peoplePerGroup to ensure that
their equations are correct. Direct students to solve for a
problem in where there is a remainder.
● Watch Basic Math in JavaScript video.
● Walk through example exercises Simple Calculator, Dollars to
Pounds, Dividing Up Groups
● Prompt student thinking by asking how variables and user
input are used in the sample exercises. Guide students to find
patterns in which functions are used to perform math and
display the result as a message. Students should note that
variable is initialized to either readInt or readFloat
● Complete Computation with Variables handout
● Students complete T-Shirt Shop and Running Speed exercise
individually or in pairs
Assessment and Exercises 2.18 - 2.19
Evaluations
Solution Guides - T-Shirt Shop
- Running Speed
Handouts & Modular Arithmetic CodeHS T-Shirt Shop
Resources (student | teacher) Exercises Running Speed
(Example
Constants
Exercises/Videos)
(student | teacher)
Computation with Variables
(student | teacher)
Vocabulary increment
decrement
Homework A) Identify three numbers in your life that can be defined using variables. For
example:
numberOfSiblings
wheelsOnMyBike
B) Solve these word problems as a JavaScript program
● Benny has 88 red marbles. Benny has 11 times more red marbles than
Dan. How many red marbles does Dan have?
● Sally earns $33 cleaning a home. How many homes did she clean, if
she made 198 dollars?
Modifications
Advanced Students Special Edu Students Struggling Readers/English
Language Learners
● Have students create ● Print out the shortcuts ● Explain to students
a program that slide used in the Basic that the pound
converts nickels to Math in JavaScript represents the
dimes, dollars to video currency that is used
dimes, etc. in the ● Allow student to first in Great Britain.
Sandbox. determine which math ● Write out the equation
● Prompt students to operations will need to that will be used for
add a message that each exercise and
displays based on the be performed in the have student
result of a conditional. student exercises. determine which
operations will be
performed and which
commands will be
used.
● Provide a copy of the
Cheat Sheet that
shows math functions
in JavaScript.