You can assign a string to a variable. You can also assign a ______.
Sorry, that's incorrect. The correct answer:
number
If a number is enclosed in quotes, it's a ______.
Sorry, that's incorrect. The correct answer:
string
What kind of operation can be done on a number variable that, in one particular case, can't be done on a string variable? Answer with a 4-letter word. (It would be a five-letter word in British usage.)
Sorry, that's incorrect. The correct answer:
math
What is the value of orderTotal?
var merchTotal
= 100;
var shippingCharge = 10;
var orderTotal = merchTotal + shippingCharge;
Sorry, that's incorrect. The correct answer:
110
Drag-and-drop. Holding down the left mouse button, drag the pieces of code onto the screen to form a statement that declares a variable and assigns a value to it.
Click in the box and type the next character. I'll autocomplete. Don't type spaces.
In a single statement, declare the variable numberAsString and assign the number 3 to it as a string.
The correct code is:
var numberAsString = "3";
Fail-safe coding. If you type the wrong character, I'll cancel the keystroke. Type spaces.
Assign to the variable caseQty, which has already been declared, the value 144.
The correct code:
caseQty = 144;
In a single statement declare a variable and assign a number to it. (You've learned only two rules for naming variables so far—no quotes and no initial number—so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var topScore = 100;
In a single statement declare a variable and assign to it the sum of 2 other variables. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var total = cost + profit;
Rewrite this statement so the variable can be used in a math operation.
var num = "9";
Sorry, that's incorrect. The correct code:
var num = 9;
Assign the sum of 2 numbers to a variable, which hasn't been declared beforehand. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var sum = 1 + 1;
In one statement declare a variable. In a second statement assign it the sum of 2 numbers. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var total;
total = 1 + 1;
Time goal: 20 seconds. (The timer starts when you click in the answer field.) In a single statement declare a variable and assign a number to it. You've learned only two rules for naming variables so far—no quotes and no initial number—so they're the only ones I'll hold you to. (The timer starts when you click in the answer field.)
Sorry, that's incorrect. An example:
var topScore = 100;
Time goal: 25 seconds. In a single statement declare a variable and assign to it the sum of 2 other variables. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var total = cost + profit;
Time goal: 20 seconds. Rewrite this statement so the variable can be used in a math operation.
var num = "9";
Sorry, that's incorrect. The correct code:
var num = 9;
Time goal: 30 seconds. Assign the sum of 2 numbers to a variable, which hasn't been declared beforehand. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var sum = 1 + 1;
Time goal: 30 seconds. In one statement declare a variable. In a second statement assign it the sum of 2 numbers. (You've learned only two rules for naming variables so far, so they're the only ones I'll hold you to.)
Sorry, that's incorrect. An example:
var total;
total = 1 + 1;
Time goal: 35 seconds. In the first statement declare a variable and assign it a number. In the second statement, change the value of the variable by adding it together with a number.
Sorry, that's incorrect. An example:
var friends = 30;
friends = friends + 10;
Live coding exercise: Declare a variable and assign it a number. Then code an alert, specifying the variable, not the number, as the message. Click the Run It button to run your code live. Type out the code. If you copy and paste it from the screen showing the correct code, it may not work.
Live coding exercise:
Type out the code. If you copy and paste it from the screen showing the correct code, it may not work.
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to jsFiddle. See my brief demo of jsFiddle.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19