| function UniversalClass() { } | There is no distinctive keyword for classes in JavaScript. Instead, each class is defined as a function. The difference between a regular function and this one is the way this function is later called: with the new keyword. The following listing implements a simple class; upon instantiation, the window.alert() box pops up. A Simple Class (class.html)| <script language="JavaScript" type="text/javascript"> function UniversalClass() { window.alert("Welcome to my class!"); } var uc = new UniversalClass(); </script> | |