CIT597 Quiz 4 (JavaScript)
Fall, 2003
Name_________________________________________

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. (10 points) In a try...catch statement, how would you write a catch clause for an InvalidNameException but no other kind of Exception?




  2. (10 points) What kind of expression is /xy+z/g and what does it mean?





  3. (10 points) Write code to define an object named point with the two numeric fields x and y, where x is 5 and y is 7.3.




  4. (10 points) Write a loop to print out all the properties (fields) and their values in object myObj.





  5. (5 points) According to your instructor, what browser has the best JavaScript debugging facilities?


  6. (15 points) What are the three ways you can put JavaScript code in the <body> of an HTML document?






  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. (10 points) What does arguments[1] refer to?



  9. (10 points) In words, how would you attach a method to all objects created by a given constructor?



  10. (10 points) Write code to replace the current window contents with the page at http://www.cis.upenn.edu/~matuszek/.