JavaScript Features

Code Snippet

Looking at the JavaScript and HTML below, answer the questions in the quiz to the right. Through the magic of JavaScript, your quiz will be automatically scored as you take it.

   <script type="text/javascript">

   function showAlert(myName)
   {
     if (myName == "Andrew")
     {
        alert("Hello " + myName + "!");
     }
     else
     {
        alert("Hello world!");
     }
   }

   </script>
</head>
<body>
<a href="#" onclick="showAlert('Andrew')">
   Say hello.</a>

Quiz

myName is a/an:

Variable
Property
Object
String

if () ... is a/an:

Function
Method
Event Handler
Conditional statement

When the user clicks on the link:

the window will close
an alert will pop-up saying “Hello world!”
an alert will pop-up saying “Hello Andrew!”
a severe weather watch will be issued for all of Montgomery county



And now, back to our agenda!