Homework 2

True or False: the following are valid JavaScript statements?
if (var == 4) { // Do something } FALSE
var testVar = 10;
True
if (a == b) { // Do something }
True
testVar = 10;
True
var case = “Yes”;
False
True or False: Semicolons are required to terminate every JavaScript statement
False
Examine the following bit of JavaScript. What is the likely result?
(Assume that the JavaScript declaration has already taken place and that this code resides properly within the section of the page.) var orderTotal = 0; function collectOrder(numOrdered) { if (numOrdered > 0) { alert("You ordered " + orderTotal); orderTotal = numOrdered * 5; } return orderTotal; }
If there is something ordered, and alert will pop up with the correct amount. Line 4 should be put after line 5 so that the correct total is displayed.


Some nights I to myself I said the words that I can´t say to no one else And I talk in my sleep I said the I never said when you were with me

Valid CSS!

Valid HTML 5.0