# Computation With Variables

```Computation with Variables
Corresponding Material
Basic JavaScript, Lesson 4
Exercises: T-Shirt Shop, Running Speed
Discussion
Variables are not only useful because they store
values. We can use variables to perform operations
like addition, subtraction, and multiplication. In this
handout, we’ll create a few variables and use them to
perform some basic computations.
Exercise
Let’s create a few variables to work with. What’s your
favorite number?
var favoriteNumber = _____ ;
On what day of the month were you born?
var dayOfBirth = _____ ;
How many books have you read this year?
var numBooksRead = _____ ;
Lastly, we’ll create an answer variable to store the
results of our computations.
var answer = 0;
Now, fill in the blanks in the table below!
Step
Pseudocode
Add day of birth and books
read, assign the result to
Subtract the favorite
number from the value of
answer, store the new
result in the answer again
Multiply answer by the day
of birth, store the value in