Object-Based Programming

[ LiB ]

Object-Based Programming

JavaScript and JScript support script execution by providing access to resources by way of objects. Both languages share the same built-in object model, which consists of a small collection of objects. Access to additional objects is provided to scripts by the browser or the WSH, depending on which environment the scripts execute in.

NOTE

Not every object has both properties and methods , although most do. For a detailed list of objects, see Appendix A.

Creating Custom Objects

Custom objects are created using the new keyword. For example, you can create a new instance of an Array object as demonstrated below.

 Animals = new Array("mice", "dog", "cat", "hamster", "fish"); 

As you can see, the new keyword is used to create an instance (Animals) of the Array object.

[ LiB ]


Learn JavaScript In a Weekend
Learn JavaScript In a Weekend, Second Edition
ISBN: 159200086X
EAN: 2147483647
Year: 2003
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net