Practice with Variables

Assignment:
The purpose of this quick exercise if to let you practise using variables in JavaScript. You will gain a better understanding of:


Choose appropriate variables for the following situations, and assign them the specified values.
  1. There are four dice, whose values are 3, 6, 2 and 4 respectively.
  2. My television is turned on.
  3. Now, my television is turned off.
  4. The name of a surgeon is Robert.
  5. Question #13 on the test has been answered incorrectly.
  6. Scott owns five cars.
  7. Scott owns the same number of computers as cars. (Hint: use the variable declared in the previous question.)

Declare the following variables:
Make corrections to the following code:

name = Mary;
lastName = Ford;
fullName = name + lastName;

firstNumber = 1;
secondNumber = 2
sum = firstNumber + secondnumber;

true = response;
printedAnswer = "The answer is" +response ".";

new Array(5);
array[5]=4;

total = 5
total = total +"10";



HOME