QUESTIONS AND ANSWERS ALL
CORRECT
How does a reference type name differ from that of a variable? - Answer-A reference
type name starts with an upper case letter
What does the "this" keyword refer to? - Answer-The "this" keyword refers to the object
instance of the reference type
What is the advantage of using "get" and "set" property definitions? - Answer-Since
JavaScript automatically creates objects, if you misspell a property name, a new
property can be created. Creating the set and get property methods prevents this issue
What is the top level of the BOM and what is its purpose - Answer-The window object
which represents the frame of the browser. Everything associated with it including the
scroll bars, navigator bar icons and so on.
What represents the page in the BOM - Answer-The document object
What can you do from the windows object - Answer-- determine the browser
- determine the pages visited
- size of the user's screen
- change text in browser status bar
- change page that is loaded
- open new windows
Which object is the global object - Answer-- the windows object is the global object
- you can access it's properties from anywhere in the web page
- you do not need to use the windows. to access the properties and methods
How can you tell the difference between a property and a method? - Answer-The
method ends with ()
List Windows objects common to all browsers and their scope - Answer-- document - all
elements and objects on a page
, - three collections - links, images, forms
- navigator - information about the browser & OS
- screen - display capabilities
- location - current page's location
- history - all pages the user has visited
What is the syntax to reference an external JavaScript file? - Answer-<script type =
"text/javascript" src="filename.js"></script>
What is the syntax of an if statement - Answer-var myVariable;
if (myVariable == 1)
{
do something
}
What are the main collections of the document object - Answer-forms, images and links
Name some of the events for a web page - Answer-onload, onunload, links[0].onclick
What do you return if you want an onclick event not to go through - Answer-return true;
what are two ways to connect an onclick event to a hyperlink? - Answer-1) add an
onclick tag inside the "a href" tag
2) add window.document.link[0].onclick = <function>
How do you throw and catch an exception - Answer-try
{throw exception;}
catch(exception){alert("here is the error");}
does JavaScript have classes? - Answer-No, JavaScript has an equivalent named a
reference type.
What three things does a reference type consist of? - Answer-- Constructor
- Method Definitions
- Properties
write out a constructor containing the following parameters - Answer-function
CustomerBooking (bookingId, customerName, film, showDate)
{
this.customerName = customerName;
this.bookingId = bookingId;
this.showDate = showDate;
this.film = film;
}