Search Header Logo
Variables Review

Variables Review

Assessment

Presentation

Computers

7th Grade

Practice Problem

Medium

Created by

Brandi Girtman

Used 9+ times

FREE Resource

9 Slides • 8 Questions

1

media

JavaScript Review: Variables

2

What is a variable?

media
  • A container for storing a value in the computer's memory

  • Once created, it can be updated repeatedly throughout the program

3

media

Use the JavaScript keyword var followed by a label and the semi-colon.

How do you create a variable?

​💡TIP: The label should describe the variable that you want to store.

4

media
  • Use the label, an equal sign, and the value followed by the semi-colon.

How do you assign a value to a variable?

​💡TIP: You don't need the var keyword when assigning the value.

  • The equal sign is called the "assignment operator"

5

Variable Naming Rules

  1. Labels CAN NOT have spaces

  2. Labels CAN NOT start with a number

  3. Capitalization & spelling MUST match

6

Multiple Choice

Question image

A variable is used to:

1

Store a value in memory

2

Draw a circle

3

Store a value that does not change

4

Draw a rectangle

7

Multiple Choice

Which of these is NOT a good name for a variable storing your middle name?

1

myMiddleName

2

middleName

3

x

4

midNam

8

Multiple Select

Question image

What can be stored in a variable?

(choose 4)

1

background

2

color

3

text

4

number

5

a sprite

9

Multiple Choice

Question image

JavaScript uses the _______ keyword to define variables.

1

var

2

variable

3

vrb

4

vari

10

media

When you create a variable AND assign it a value in one line of code.

Initializing a variable

When assigning values, the equal sign

  • Is not the same as math class

  • In JavaScript, it sets the value

media

11

12

media
  • Sometimes, you can't see the value of your variable in the program.

One Problem with variables...

  • ​Use console.log(label) to show the value of the variable in the console log.

13

Multiple Choice

How would a computer programmer read the following line of code?

var xPosition = 500;

1

The variable xPosition is equal to 500.

2

The variable xPosition gets the value of 500.

14

Multiple Choice

How do you use a variable that has been initialized (created & given a value) in your program?

1

By using a function

2

By typing its name

3

By opening a file

15

Fill in the Blanks

Type answer...

16

Multiple Choice

Which line of code is written correctly?

1

var 2position = 25;

2

var yPosition = 12

3

var xPosition = 25;

4

var shoe size = 10;

17

media

JavaScript Review: Variables

Show answer

Auto Play

Slide 1 / 17

SLIDE