CIT597 Quiz 3 (JavaScript)
Fall, 2007

Please keep all answers short and to the point. Read each question and answer it; don't add information that wasn't asked for.

  1. (5 points) Within a function, how would you declare a new global variable x?

  2. (5 points) Within a function, how would you define a new local variable y (where y isn't a parameter)?

  3. (10 points) Name the three primitive types in JavaScript.

  4. (5 points) What is the same about the way that the keywords class, int, and static are treated in a JavaScript program?

  5. (5 points) What does the keyword void do?

  6. (5 points) Why should JavaScript functions be defined in the <head> rather than in the <body> of an HTML page?

  7. (10 points) After executing the following three statements, what is the value of y?
         var f = function(x) { return x + 3; }
          x = 10;
          y = f;

  8. (5 points) Write a literal array containing the values "CIT" and 597, and assign it to a variable array.

  9. (10 points) What does arguments.callee refer to?

  10. (10 points) Tell two things you can do with a previously defined function func that you cannot do in Java.

  11. (5 points) In the HTML DOM, document is a field of what object? (Give its exact name, as it would appear in a program.)

  12. (15 points) Name any three of the arrays in a document object.

  13. (5 points) In order to refer to a button object without having to count out its position in an array, the button tag should be given an attribute named ________________.

  14. (5 points) What is the easiest way to show a debugging message from a JavaScript program?